News for hackers. Stuff that matters.
Re:History of Lisp Parentheses (2019) by bmitc on Wednesday February 01, 2023 @01:59PM (#34615730)
I like Racket's way of handling them, to a degree. Each of {}, [], and () are interchangeable, and the use of [] is mostly down to convention. For example, it is often used in let bindings:

    (define x
      (let ([a 1]
            [b 2])
          (+ a b)))
By to a degree, I would actually prefer if the convention is enforced.
Re:History of Lisp Parentheses (2019) by gsinclair on Wednesday February 01, 2023 @10:44PM (#34621763)
The convention is enforced in Clojure. [] for bindings, {} for maps.
Re:History of Lisp Parentheses (2019) by funcDropShadow on Thursday February 02, 2023 @03:15AM (#34623686)
It is not a convention in Clojure. (), [], {}, #{} represent different data structures.
Re:History of Lisp Parentheses (2019) by Sakos on Thursday February 02, 2023 @04:01AM (#34624005)
It's really just syntactic sugar, so I would agree with the statement that the convention is being enforced.
Re:History of Lisp Parentheses (2019) by funcDropShadow on Friday February 03, 2023 @10:46AM (#34642603)
You get different data structures. I.e. printing #{ 1 1 2 2 } prints #{ 1 2 } whereas [ 1 1 2 2 ] prints [ 1 1 2 2].
Re:History of Lisp Parentheses (2019) by tmtvl on Thursday February 02, 2023 @08:18AM (#34626108)
Not exactly, it uses square brackets for vectors sometimes and curly brackets for maps sometimes, yet other times it uses square brackets for maps:

  (let [a 1 b 2] (+ a b))
Instead of:

  (let {a 1 b 2} (+ a b))
(I think my map notation may be wrong, I always just bounce off Clojure so I'm bound to make mistakes).
Re:History of Lisp Parentheses (2019) by shaunsingh0207 on Thursday February 02, 2023 @03:07AM (#34623624)
I quite like how fennel handles it as well, {} for standard lua tables and [] for arrays, but [] stands to define variables in a let binding. Of course this comes from Lua's quirks, but its a nice, sane way to handle it.
Re:History of Lisp Parentheses (2019) by lispm on Thursday February 02, 2023 @03:33AM (#34623813)
This is an old feature of some Scheme implementations. There are also books where the Scheme code is written this way, IIRC.