5 ms·
I have tried lisps looking for the famed syntactic purity but I didn't really find it. For example, following the little schemer books, they don't print scheme
by duncanawoods 11y ago
I have tried lisps looking for the famed syntactic purity but I didn't really find it.
For example, following the little schemer books, they don't print scheme as the actual ascii you need to type, instead they use typography like bold, italic and greek symbols that you have to replace with the uglier reality to distinguish between things like s-expr from lists. It feels like they are embarrassed by the cludgy real syntax, so they hide it and push the difficulty on to the reader.
To give clojure a whirl, I was prepared for lispy paren extravagance but when translating a small program to my best guess at idiomatic clojure (I'm sure I failed) there were so many non-s-expr syntactic special cases for things like list comprehensions and common macros that the result felt like it was jealous of non-s-expr languages and didn't actually want to be a lisp.
In truth, I believe a strong contrast between different syntactic elements helps readability, so I don't think the s-expr regularity I expected is something I actually want.
- undershirt 11y ago> ... they use typography like bold, italic and greek symbols that you have to replace with the uglier reality to distinguish between things like s-expr from lists. My main complaint with Scheme is that it's hard to distinguish a "call" from a plain list. For example, in `(let ((foo 1) (bar 2)))`, `let` is a call, but `foo` and `bar` are just being assigned, not called. Clojure uses `(let [foo 1 bar 2])`, so you can tell that `let` is a call, but `foo` and `bar` are now unwrapped and placed inside square brackets to signify plain data, not a call. > To give clojure a whirl, ... there were so many non-s-expr syntactic special cases for things like list comprehensions and common macros Everything is still an s-expr. The square and curly braces still follow the same rules, but they just mean they are not "calls" like parens would normally signify. For a list comprehension example: `(for [m messages] (str m))`, `for` and `str` are calls and `[m messages]` is just data. It could be unwrapped like `(for m messages (str m))`, but it's wrapped in square brackets as a visual indicator for what's important. But if it was wrapped in parens like in Scheme, it could be confused as a "call". Clojure is very well-designed to solve visual problems of Scheme and other Lisps. I recommend looking at it again :D
- jwdunne 11y agoFrom what I can tell, Scheme (or it may be a Racket thing) allows the use of square brackets - this aids in readability greatly. There is no type difference as there is in Clojure.
- goldfeld 11y agoWith the downside being inconsistent style across the community, making for more overhead when reading code (see also macro abuse). Scheme has bigger fragmentation problems anyhow.