3 ms·
Just curious: what’s your level of fluency with Clojure/lisp syntax vs C-style syntax? I found that learning to read the lisp-style indentation (which is purel
by filoeleven 6y ago
Just curious: what’s your level of fluency with Clojure/lisp syntax vs C-style syntax?
I found that learning to read the lisp-style indentation (which is purely by convention but has widespread acceptance and tooling support) was a pretty fast process with a solid payoff. It becomes easier to jump between levels of detail, and I now find it to be more readable than C-style syntax, even though I only write JS for work.
For example, in the code above, “what it does“ is made clear by reading downward without looking very far to the right: it draws a button with a click handler and a label. There is a guarantee offered by immutability that says “anything deeper than my current level cannot affect things outside of itself.”
That may sound like a lie, since the :onClick handler updates an atom, but knowing that a dereferenced atom (@count) has a stable value during the lifetime of the function call resolves it.
I don’t know how strong that guarantee is with other lisps; I think Clojure’s immutability plays a key role though.
- CraigJPerry 6y agoYeah i agree the readability is purely a lack of familiarity on my part rather than some fundamental difficulty in the syntax. If anything, the clojure syntax has fewer rules to understand - from my very limited knowledge of it.