Re:LispyScript: A JavaScript With Lispy Syntax And Macros
by zem on Friday September 21, 2012 @07:08PM
(#4556385)
fair point (i was actually planning on adding a lisp cond by way of contrast, and then forgot). my contention is that the ml cond looks a lot less cluttered than the lisp one, and is therefore more pleasant to read.
the clojure one is nicer since it lacks the visual clutter of the per-case enclosing parens, but it feels slightly wrong from a lisp perspective since i'm now replacing [(a, b), (c, d)] with [a, b, c, d] which has changed the innate structure of the expression.
i actually like the racket convention of using square brackets to distinguish this the best of all the lispy options:
(defn factorial [n]
(cond
[(<= n 1) 1]
[:else (* n (factorial (dec n)))]))
the clojure one is nicer since it lacks the visual clutter of the per-case enclosing parens, but it feels slightly wrong from a lisp perspective since i'm now replacing [(a, b), (c, d)] with [a, b, c, d] which has changed the innate structure of the expression.
i actually like the racket convention of using square brackets to distinguish this the best of all the lispy options: