Hacker News new | ask | show | jobs
by ReleaseCandidat 1111 days ago
There are things I'll never understand. Why would anybody do this? Why Clojure and not Emacs Lisp?
6 comments

Emacs lisp is a terrible lisp dialect. If it wasn't for Emacs' popularity it would have died decades ago. This is just one example in a long line of examples where nobody willingly implements Emacs lisp. Even in Emacs there is pressure to move towards Common Lisp.

Emacs lisp has, as far as I can tell, no advantages. It isn't especially good at text editing. It introduces differences from more popular lisp dialects. Anything it offers could be a library in some other lisp.

Clojure on the other hand, has a couple of nice syntax innovations and smooth default data structures.

Clojure is a language created and "controlled" by a single author (pretty unified overall) as a general purpose language, with implementations for multiple languages.

Emacs Lisp (elisp) is a language specifically created as a scripting language for an editor, maintained by an organization, with one compiler (AFAIK) and 99% of usage is within Emacs.

It's not hard to imagine people preferring Clojure before elisp, especially outside of Emacs.

To be honest, I would prefer Clojure to Elisp too.

But to be frank, it's hard for me to imagine people preferring Vim over anything that isn't ed ;). Although, at least using ed you don't need to type the colons :)

That would be awesome. Next step: run evil-mode on top of it.

We've come full circle.

Some people like Clojure syntax rather than S-expressions. Personally I don't get it, having arbitrary lists that require square instead of round brackets, arbitrary lists where pairs which belong together aren't grouped, and arbitrary lists where commas are interpreted as optional whitespace gives me a headache; but to each his own.
Clojure still uses S expressions, it just has more than just lists available. Square brackets don't make lists, they make vectors. Commas are always optional. I don't know what you mean by "arbitrary lists where pairs which belong together aren't grouped", but maybe you mean maps or sets, which are also not lists but a different data type.

  user=> (type [])
  clojure.lang.PersistentVector
  user=> (type '()) ; gotta quote the list
  clojure.lang.PersistentList$EmptyList
  user=> (type {})
  clojure.lang.PersistentArrayMap
  user=> (type #{})
  clojure.lang.PersistentHashSet

Different data types are used for different things. Vectors have more natural insertion behavior, so most people use them where that might happen.

  user=> (conj '(1) 2)
  (2 1)
  user=> (conj [1] 2)
  [1 2]
The example that most typifies my issues with Clojure syntax is let-binding. In Lisp it's very clearly structured:

  (let ((foo bar)
        baz
        (quux frob))
    ...)
In Clojure not only are the bindings unstructured, they are thrown into a vector. Not a list, not a map (for which Clojure has dedicated syntax, mind), a vector.

  (let [foo bar baz quux frob]
    ...)
And that is one of the only two places I know of where Clojure arbitrarily uses a vector when it uses lists everywhere else:

  (defn foo [bar] ...)
Instead of either of:

  (defn foo (bar) ...)
  [defn foo [bar] ...]
"There are things I'll never understand."

=> true

Hmm, that's

    > "There are things I'll never understand."
    "There are things I'll never understand."
for me. But

    > (cond ("There are things I'll never understand." 'true))
    true
works.

Seriously I'm glad to not understand everything, that would be quite worrying and/or boring.

because the author wants it?