Why don't people like lisp?

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Sun Oct 19 10:20:40 EDT 2003


On Sun, 19 Oct 2003 13:18:38 +0200, Edi Weitz wrote:

> In fact, once you get it, you realize that every single form in Lisp
> has exactly the right number of parentheses and as long as you know the
> arglist (tools like ILISP will help with that) it's a no-brainer to know
> how many parens you'll need.

The problem is not that I don't know why each paren is there. I know it.
It doesn't help with the fact that there are a lot of them and that code
is not easily readable because of deep nesting.

> As others have pointed out it is _essential_ to use Emacs or an Emacs
> clone (like Hemlock or the editors coming with the commercial Lisps)
> if you're going to write Lisp programs.

What about reading (in books, on WWW)? I guess you would say
"indentation"...

Indentation in Lisp is not clear enough. Let's look at an example from
http://www-users.cs.umn.edu/~gini/aiprog/graham/onlisp.lisp:

(defun mostn (fn lst)
  (if (null lst)
      (values nil nil)
      (let ((result (list (car lst)))
            (max (funcall fn (car lst))))
        (dolist (obj (cdr lst))
          (let ((score (funcall fn obj)))
            (cond ((> score max)
                   (setq max    score
                         result (list obj)))
                  ((= score max)
                   (push obj result)))))
        (values (nreverse result) max))))

Note that only one pair of adjacent lines is indented by the same amount.
Other alignments are in the middle of lines.

Here is a straightforward translation into my dream language; note that
there aren't a lot of parens despite insignificant indentation and despite
using braces (like C) instead of bracketing keywords (like Pascal):

def mostn Fun [] = [], null;
def mostn Fun (First\List) {
   var Result = [First];
   var Max = Fun First;
   each List ?Obj {
      let Score = Fun Obj;
      if Score >  Max {Max = Score; Result = [Obj]}
      if Score == Max {Result = Obj\Result}
   };
   reversed Result, Max
};

                                           | Lisp | Python | above
-------------------------------------------+------+--------+-------
          different amounts of indentation |  10  |    4   |   3
                at the beginnings of lines |      |        |
                                           |      |        |
           maximum number of nested parens |   9  |    1   |   4
                                           |      |        |
 maximum number of adjacent closing parens |   5  |    1   |   2
                                           |      |        |
                    total number of parens |  60  |   16   |  18
                      where paren = ()[]{} |      |        |

This is why I don't find Lisp syntax readable. It requires apparently
3 times more complicated nesting structure to express the same thing.

-- 
   __("<         Marcin Kowalczyk
   \__/       qrczak at knm.org.pl
    ^^     http://qrnik.knm.org.pl/~qrczak/





More information about the Python-list mailing list