3 ms·
Can you elaborate? I like the extra context that square brackets give.
by aeonik 3y ago
Can you elaborate? I like the extra context that square brackets give.
- tmtvl 3y agoI just find it inconsistent. Lisp is (at least nominally) about processing lists, so I don't know why the list (foo bar baz) has to be different in: (if bar (foo bar baz) baz) When contrasted to: (define-function quux [foo bar baz] ...) If you use square brackets [x y z] as shorthand for round brackets (vector x y z), that's fine, but don't use them for basic syntactic elements.
- zelphirkalt 3y agoI find square brackets quite useful for some kinds of expressions, that have multiple cases or branches. To make a visual difference there can help with readability.
- tmtvl 3y agoI use rainbow delimiters (colourful brackets) for that, but I can accept square brackets as an alternative for people who have issues with colour perception.
- Jach 3y agoI also find square brackets useful for other kinds of expressions, like Python-style list comprehensions. Though such syntax predates Python, e.g. there's a paper from 1991 https://3e8.org/pub/scheme/doc/lisp-pointers/v4i2/p16-lapalme.pdf https://3e8.org/pub/scheme/doc/lisp-pointers/v4i2/p16-lapalm... whose code still works in Common Lisp. If the language doesn't mandate that square brackets mean something, as Clojure does, then I can make them mean what I want that is convenient for my namespace, as Common Lisp allows. Whether that's data literals or special syntax or something like [x (x <- xs) (oddp x)] to filter out odds, it's nice to have that choice.