4 ms·
> Clojure introduced meanings for [] and {} in a Lisp Lisp was using [] and {} before in a lot of software. For example this is a data structure in Connection
by lispm 10y ago
> Clojure introduced meanings for [] and {} in a Lisp
Lisp was using [] and {} before in a lot of software.
For example this is a data structure in Connection Machine Lisp called Xapping, basically a parallel hash table:
{moe->"Oh, a wise guy, eh?" larry->"Hey, what's the idea?" curly->"Nyuk, nyuk, nyuk!"}
Straight from the 80s.
Scheme was using [] also many years before in the standard, programs and books.
- taeric 10y agoMy thought is that the confusion is most people are taught that lisp has no syntax. And that they should avoid the reader macro at all costs. Few, then, actually dive into large programs in lisp to see how real programs actually look. In this example, though, what was the advantage of the special syntax? (I'm assuming there was one. Just a lot of these parallel hash tables written in literal form?)
- lispm 10y ago> taught that lisp has no syntax Which is wrong. It's just that Lisp syntax looks and works a bit different. Especially there is a data syntax for s-expressions and the syntax for the programming language Lisp is defined on top of s-expressions. > And that they should avoid the reader macro at all costs. Common Lisp itself uses read macros for its implementation. Applications use them in various ways. > In this example, though, what was the advantage of the special syntax? Xappings were a central data structure in Connection Machine Lisp, thus it's not unusual that it had a printed representation.
- taeric 10y agoAgreed on your points. Especially that it has syntax. But look at the linked post upthread. I said "no" syntax, but that was me being admittedly lazy. Quote there was "Lisp is a language with little syntax". Which has me wondering why it has that general view with everyone. For the representation.. So this was not simply a literal syntax, but a serialization one. Which makes sense. And I can see why the serialization syntax is easily usable as a literal one.
- kazinator 10y agoGCC's C parser is a 550 kilobyte file that is almost 19000 lines long. The C++ one is over 1.1 megabytes long, and close to 39,000 lines. Github refuses to display it as code, only raw. Lisps don't have anything that even comes close.
- taeric 10y agoBut that is a different claim, isn't it? I would expect that the general parser for a CL implementation is also quite large. My question is why does the teaching often go that there is practically no syntax for lisp. Now, it is often followed quickly with "in lisp, you can write your own language." But then, those two thoughts are hard to justify next to each other. Again, just see this thread. The complaint is that there is not enough syntax in lisp. The argument appearing that you have to have another language to express some ideas. And again, I'm not even disagreeing with this claim. Just trying to understand why it has the foothold that it does. That you drop to lisp if you want to use no syntax.
- kazinator 10y agoJust checked an old clisp-2.32 source tree I have laying around on an old hard drive. The raw line count in the src/ directory over all .d and .lisp files is 212K. Compiler, CLOS, all in there. The io.d module (preprocessed C source) which contains the reader and printer, plus some other cruft, is 10K.
- taeric 10y agoJust wow. I would expect it to be smaller. But I am surprised it is that much smaller.
- lispm 10y agoSince many/most Lisp macros implement syntax, there can be a lot of syntax in Lisp, too. The parsing of the syntax is distributed over the macro definitions, sometimes with some help of the general macro mechanism. See for example the syntax which is implemented by macros like LOOP or ITERATE. The LOOP syntax is documented in the ANSI CL spec... http://www.lispworks.com/documentation/lw51/CLHS/Body/m_loop.htm http://www.lispworks.com/documentation/lw51/CLHS/Body/m_loop...