Hacker News new | ask | show | jobs
by hota_mazi 1111 days ago
And yet, Clojure, the most used Lisp today, decided to use brackets instead of parentheses for parameter lists, breaking with 50 years of Lisp tradition. How dare they??

But I'm sure you know better than them.

3 comments

When Lisp first appeared, square brackets were not even standard characters. Maybe McCarthy would use them if he could.

The word "set" is much older, and is universally supported.

But most glaringly, (= a b) has a well-understood and entirely different meaning in most lisps, also since 1950s. It's comparison, not assignment. Breaking a well-set convention is a very different thing than making a new, slightly improved convention.

My original post includes "there doesn't seem to be a compelling reason for ignoring it". I'm not arguing for tradition for tradition's sake.

I don't think using = instead of define/defun/defn has a compelling reason. Clojure's use of [], {}, #(), etc., is compelling to me. I'm not a Lisp purist who thinks everything should be parentheses. Adding that syntax is helpful for the reader.

Innovation is welcome when it's beneficial. = for assignment isn't.

Using [] to style function formal parameters is completely pointless. It literally serves no purpose. It just makes it gratuitously different from other languages (not only Lisps). In most mainstream languages, both formal parameters and actual parameters use parentheses.

There would be a sense to it if square brackets shifted into some alternative semantics: (fn (...) ...) versus (fn [...] ...) doing something usefully different.

If you must use square brackets there, they are just a syntactic quirk that doesn't enable any new semantics.

Everyone who uses Clojure, and even people who don't, but know Lisp, understand the point: since parentheses are used in Lisp to delineate everything, it makes sense to use a different pair of symbols to make parameter lists stand out more.

Maybe saying it's "completely pointless. It literally serves no purpose" is a bit overly dramatic, don't you think?

You could have limited yourself to saying you don't personally like it because it breaks with tradition.

> it makes sense to use a different pair of symbols to make parameter lists stand out more.

Quite simply, no, it doesn't.

> you don't personally like it because it breaks with tradition.

Nope! I don't impersonally like it, because it's a gratuitous inconsistency which doesn't do anything. It's not technically justified in any way.

How does it make sense to have the formal parameter stand out? Why don't we want the function body to stand out? (fn (a b) [+ a b])?

Don't the parameters already stand out by being on their own line (usually)?

   (defn (a b)  ;; <-- sticks out like sore thumb
     ...) 
If you think something deserves to stand out in code, can't you teach your editor to highlight it?

Where are the numbers to back all this "sense"?

Scheme used braces at least a decade or two before clojure even existed.
March 1960, the Lisp I Programmer's Manual:

  ff[x] = [atom[x] -> x; T -> ff[car[x]]]
or

  DEFINE ((
    (FF (LAMBDA (X)
          (COND ((ATOM X) X)
                (T (FF (CAR X))))))
    )) ()
which one or two decades later would be in Lisp:

  (defun ff (x)
    (cond ((atom x) x)
          (t (ff (car x)))))