6 ms·
I wanted to love Lisp after learning about it in "Gödel, Escher, Bach", and then in PG's Blub essay (which is why I'm a HN fan). The syntax is just off-putting
by pstuart 4y ago
I wanted to love Lisp after learning about it in "Gödel, Escher, Bach", and then in PG's Blub essay (which is why I'm a HN fan).
The syntax is just off-putting and I was never compelled to learn it in school, so I remain in algol-land. If time and focus allowed I'd do the SICP self study path but it's too easy to surf HN and Reddit instead.
- Test0129 4y agoSICP is a good way to learn about programming from first principles. It is not the best way to learn CL. CL and scheme are extremely different despite having similar roots.
- lispm 4y agoIt's not even the best book to learn actual Scheme. SICP's main purpose is to teach computer science basics using a tiny subset of Scheme (no macros, no error handling, no libraries, ...).
- throwaway81523 4y agoScheme didn't have macros when SICP was first written, iirc.
- nemoniac 4y agoScheme already had macros in 1975 [1] SICP was first published in 1984 [2] [1] https://stackoverflow.com/a/69261645/3414663 https://stackoverflow.com/a/69261645/3414663 [2] https://en.wikipedia.org/wiki/Structure_and_Interpretation_of_Computer_Programs https://en.wikipedia.org/wiki/Structure_and_Interpretation_o...
- throwaway81523 4y agoThat says (some) implementations had macros from the beginning, though those macros were much different than what was eventually standardized in (I think) r5rs. I guess I can believe that. I don't know when Guile got macros. Philip Wadler's paper discussed and linked from here is also interesting: https://www.wisdomandwonder.com/link/1055/why-calculating-is-better-than-scheming https://www.wisdomandwonder.com/link/1055/why-calculating-is...
- lispm 4y agoSICP was largely written before Scheme was standardized and before SRFI existed. For example SICP uses a so-called special form called cons-stream, which is in no Scheme definition (it was in no Scheme reports) and for which no implementation is given in the book, since it can't be implemented by the Scheme subset used for the book. It assumes that it is somehow provided without giving any details. Related: https://srfi.schemers.org/srfi-216/srfi-216.html https://srfi.schemers.org/srfi-216/srfi-216.html
- throwaway81523 4y agoThanks, yeah ok, it hadn't occurred to me that cons-stream has to be a macro. I also remember the book also explaining how force and delay work in terms of wrapping and later evaluating a lambda, but don't remember if it explained that delay has to be a macro too. I guess the Common Lisp approach to macro hygiene is using gensyms for temporaries, but Schemers saw that as too ugly. I wonder how Clojure does it. I'm not that big on Scheme or Lisp these days anyway though.
- lispm 4y agodelay is mentioned to be a special operator, too.
- jcynix 4y agoNo personal attack intended, but what I always find funny: the complaints about Lisp's syntax. Lisp's syntax is regular prefix notation all over and one of the defining features of the language. Algol languages on the other hand, and math even on paper, are a rather wild bunch: they mix infix operators like plus/minus (1+1), multiplication/division (2*2), have postfix operators like faculty (9!) and even user defined functions f(x, y) in prefix notation. That should be way more off-putting theoretically, but people just grew up with this "mess" and think that fine. Disclaimer: besides Lisp, I program in Perl or Shell too ;-)
- waynecochran 4y agoLisp really doesn’t have syntax… it’s an abstract syntax tree which is the output of most parsers
- munch117 4y agoCL has huge mounds of syntax. Every macro or special form adds to it.
- kazinator 4y agoMacros don't add syntax; they just add semantics to syntax that already exists. You can write down the syntax of a call to a macro which has not yet been written, and Lisp will read it for you, giving you the tree. It just won't be able to expand it since the semantic definition through the macro name isn't there. A conventional language will not do that. C++11 will not correctly read the shape of a C++17 phrase structure, and just complain about it not being defined. Lisp macro can treat their arguments as a flat stream of tokens and parse them, even with LALR(1) parser generator or whatever. It's not not the typical way most macros are written. Macros leverage the ability of the invocation syntax to express pre-parsed nested structures. Even if a macro goes crazy like that, it's still self-contained; the churning toilet bowl of parsing it has whipped up is cleanly confined within the boundaries of the macro call, which can be cleanly substituted anywhere an expression can be used.
- kazinator 4y agoI'm starting to suspect that some people have a visual/cognitive difference which prevents them from seeing ( ... ) as an enclosed unit. I recently made a comment on this topic here: https://news.ycombinator.com/item?id=33049170 https://news.ycombinator.com/item?id=33049170 There are probably some engineers who have "dyslispia", to whom the normal example with the usual parentheses doesn't look any better than the messed up examples.