Hacker News new | past | comments | ask | show | jobs | submit login

Your example is nonsense. Clojure's keep is based on lazy sequences instead of concrete lists, and is also optimized for performance.

That said, you raise a point that occurred to me recently, and it relates to Clojure's literal representation of data beyond lists and your point about the "ruined magic".

In most Lisps, the only evaluation semantic is that of the "operator form": a list of operator car and arguments cdr, both of which are evaluated themselves.

Clojure, however, adds an evaluation semantic for its data literals. Consider this code:

{(+ 1 2) (+ 3 4)}

It results in the map {3 7}, but where is the "operator form" that caused the top-level evaluation?

In Lisps with reader macros, an expression like above boils into code resembling (hash-map (+ 1 2) (+ 3 4)), a classic "operator form", which is then evaluated.

In Clojure, however, which does not provide reader macros, there is no intermediate list representation of the expression accessible to the programmer. Effectively, Clojure adds evaluation semantics to Lisp beyond "operator forms": data literals evaluate their contents, and qualify in many ways as "special forms".

I have run into at least one implication of this design having to do with the structural representation of Clojure code. With a "classic" Lisp, an IDE or editor is empowered to present to the user any representation of the code, and can convert it to Lisp expressions arbitrarily the same way reader macros do.

With Clojure, this type of "skinning" is harder, because IDE-like navigation of data implies ordering. The ordering exists in the character-wise representation of a map like {3 4} but not in its evaluated counterpart.




All of Clojure's literals desugar to calls. They're reader macros you can't add to.


My point is that they desugar directly to data structures (instantiated in Java, in LispReader) instead of operation forms that evaluate to data structures.

See vector creation: https://github.com/clojure/clojure/blob/52633274225370dfb058...


I don't see how that distinction is useful.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: