Derisive comments are often made about the syntax of Lisp,
as witness some reproaches on
my previous blog entry.
Thus the half-joking, half-serious backronym of
Lots of (Insipid | Irritating | Infuriating | Idiotic | ...)
and (Spurious | Stubborn | Superfluous | Silly | ...) Parenthesesand accusations that Lisp syntax would make
(
Read more... )
--(let ((a 1) (b (+a 1 2) (c 3))
----(if (= a 1)
-------(setq c 2)
-------(progn
----------(setq a 1)
----------(do ((i 1 (+ 1 i)))
-------------((> i 5))
-------------(print i)))))))
(unsure of correct amount of closing parentheses)
That above program could be written with the exact same syntax using python-like whitespace conventions as:
deffun foo()
--let a 1 b (+a 1 2) c 3
----if = a 1
------setq c 2
------progn
----------setq a 1
----------do i 1 (+ 1 i)
------------> i 5
------------print i
the if struct could be clearer with python/ruby/vb conventions of using then or : and else keywords, but any S-expression can be written with minimal parenthesis by using newline and indentation (for scope) conventions from python. The only way lisp is readable is with these conventions anyway, but its mind boggling why we have to type them in... when a pre-processor could do without.
The other improvement to lisp parsers would let you right the if form as (if (exp) :then (doiftrue) :else (doifnot)) -- and no reason, since the terms must be ordered, to not be able to parse (if exp : doiftrue : doifnot). While if tends to be readable without the extra sugar, the do form is a nightmare (do (varsetup) :untilcond (exp returnval) :body (...)) would clean it up. There is no more reason to work with pure s-expression formatted code then there is with xml. Its totally unacceptable to force the lisp absurdity on the user.
The world has not moved to python because it executes 10 times slower than lisp, or hasn't bothered to implement lisp macros yet, it went there because the language is sane, and author has a basic respect for making the language useable.
Reply
http://www.dwheeler.com/readable/
Reply
(let ((a 1)
(b (+a 1 2)) <- This will fail
(c 3))
You could however use let* for that kind of thing.
Reply
Leave a comment