3 ms·
Clojure and Clojure-like Lisps (Janet, Hylang) use fewer parenthesis by replacing them with other pairs of characters ([], {}) for certain block structures, whi
by Zambyte 3y ago
Clojure and Clojure-like Lisps (Janet, Hylang) use fewer parenthesis by replacing them with other pairs of characters ([], {}) for certain block structures, which is exactly what other non-Lisps do. The only difference is that Clojure still puts the opening character at the beginning of the structure instead of in the middle, like how non-Lisp languages usually do.
- thih9 3y agoTo be fair, there are more differences; where Clojure requires parentheses, non-Lisps often don't need them at all. E.g. in Python indentation carries meaning. Ruby has "do/end"; but also it's possible to skip parentheses in some function calls; there are pipes too. Haskell - whatever haskell does, sometimes also pipes. There are more examples. That being said, for me clojure parentheses were always more of a help than an inconvenience.
- behnamoh 3y agoI actually find Clojure's syntax more confusing with all the punctuation they threw at it. Compare that, for example, with Scheme. I like the idea of keeping Lisps "pure" if that makes sense. In Lisp, the first element of a list is the operator. Okay, then how is Clojure a Lisp when it has vectors like this [1 2 3]? Unless [ is a macro that expands [1 2 3] to some real Lisp-y expression under the hood.
- fndex 3y ago> I actually find Clojure's syntax more confusing with all the punctuation they threw at it. Could you give some examples? Or "all the punctuation" you are referring just to []?
- Zambyte 3y agoI'm not the same person you asked, but I find Clojure to be as easy to read as Scheme, but harder to write, since I need to remember what punctuation to use where.
- capableweb 3y agoI don't know, it makes sense to use different data structures for different purposes. (), [], {} are all different data structures (lists, vectors and maps) that are useful in different situations, so makes sense to have shorthands for them.
- dreamcompiler 3y agoMaybe. What bothers me about this idea is that it doesn't scale: As soon as you need a fourth bracket type you're hosed, because there are no more on the keyboard. With Common Lisp, you can define [ and { if you want to, but it's more common to use a reader macro character in front of an opening paren or a function name after it if you want different data structures. Those approaches scale.
- pseudonamed 3y agoIt's a literal vector in the sense that '(1 2 3) is a literal list. Though unlike the quoted list it evaluates to itself, like a string or an int does.