3 ms·
The reality is that just about every single lisper will insist how they don't see the parenthesis and they are not a problem, and just about every single lisp h
by patrec 5y ago
The reality is that just about every single lisper will insist how they don't see the parenthesis and they are not a problem, and just about every single lisp has some ugly ad hoc hacks to reduce their clutter. They just differ somewhat between lisps.
Scheme (and descendants like racket) went so far as to make [] and () interchangeable. So you will in fact see brackets in some scheme most e.g. (let ([a 1] [b 2]) ...) is a common idiom, although old-school people stick to ().
Common lisp has stuff like loop, () aliased to nil (different connotations), and a verbose way to call passed or returned functions; it shares its infix pair syntax (head . tail) with scheme. Scheme, unlike common lisp has a pretty complex (hah) infix-syntax for complex number literals; both write rationals infix.
And have a look at the Lisp 1.5 manual some time :)
As far as such hacks go, this use of vectors in clojure is actually quite nice. Whereas the fact that clojure, unlike other lisps, uses "invisible" pairing brackets in binding constructs or "visible" whitespace in the form of commas for associative containers is a big pain in the ass for editing and formatting code.
[edit: fixed idiomatic let bracket/paren split, as pointed out by version_five]
- bjoli 5y agoOnly R6RS made () and [] interchangeable. That was hugely controversial, with opponents (myself included) thinking it was a waste of 1/3 of the matching pair symbols. And the suggested use was not quite the syntax you showed: http://www.r6rs.org/final/html/r6rs-app/r6rs-app-Z-H-5.html http://www.r6rs.org/final/html/r6rs-app/r6rs-app-Z-H-5.html
- patrec 5y agoI fully agree (and thanks for the idiomatic let bracket ordering correction). But the fact that terribly hacks like this are nonetheless adopted shows how much of a pain the paren clutter is and that claims to the contrary are pure cope.
- mpfundstein 5y agoi maintain two large CL code basis. there is no pain because of parens. really not...
- bjoli 5y agoIt is not a terrible hack. It is a useful thing to do if you dont have things like paren highlighting or paredit. I am firmly in the "paren clutter doesn't exist" camp.
- deckard1 5y agoScheme reports lag, though. They usually codify what existing Scheme compiler/interpreters are already doing. I know I've seen plenty of Scheme code in the wild using square brackets interchangeably long before R6RS came out. You can even see the rationale behind this in the Scheme FAQ on Scheme Wiki, which seems to not have been updated since R5RS was current [1] [1] http://community.schemewiki.org/?scheme-faq-language#H-yoyi82 http://community.schemewiki.org/?scheme-faq-language#H-yoyi8...
- Zababa 5y ago> a waste of 1/3 of the matching pair symbols I count 5, (), [], {}, <> and /\ though the last one is a bit of a stretch (but it's reversible: \/). Am I missing something? Did you mean "1/3 of the matching pair symbols left" as () is already used? Or is <> not usable?
- bjoli 5y agoThere are functions starting with < and > so that's no good. And / and \ are already used elsewhere.
- lispm 5y agoThe use of square brackets in Lisp and Scheme is much older. IIRC there were Scheme books which used them much earlier. Interlisp also for example uses square brackets. The left square bracket is equivalent to a round bracket and the right square bracket closes all open levels of brackets.
- adrian_b 5y agoThere have been LISP dialects where a single closing square bracket was used to close all the remaining open round parentheses.
- medstrom 5y agoSounds useful for an interactive shell. Perhaps even Fish shell could adopt it.