4 ms·
mr. Norvig is a great man, no doubts. Have you read AIMA, by the way? I did.) This, of course, is not a "complete" Lisp. Let's say that [one of] the most funda
by dschiptsov 12y ago
mr. Norvig is a great man, no doubts. Have you read AIMA, by the way? I did.)
This, of course, is not a "complete" Lisp. Let's say that [one of] the most fundamental feature of a Lisp is ability to define a new "special form" (without modifying the code of the interpreter) as a [reader] macro. This is the way of defining a DSL. the loop constructs, structures, even whole CLOS is nothing but a DSL.
All we need is quote, quasi-quote, unquote, unquote-splicing, the "conses-aware" read function which "expands" these and the if special form that "short-circuits".
This (everything is made out of conses + general evaluation rule + reader macros) could be called a Lisp.
Want to see a Lisp? Look at arc.arc
- gkya 12y agoThis “DSL” acronym is used everywhere nowadays; mistakenly so I think. A DSL (domain specific language) is like cold-fusion, R or VHDL; it is a complete language designed with the target domain in mind.
- dschiptsov 12y agoNow tell us, please, how looping constructs in CL aren't DSLs and how it how it contradicts your definitions. hint: the term DSL was popularized by SICP. One needs high-order procedures to implement a simple DSL, the feature which wasn't available in most language but Lisps.
- gkya 12y agoWell, looping constructs are not related to a particular domain (e.g. electronic circuit design), but are general purpose construct.
- coldtea 12y ago>Let's say that [one of] the most fundamental feature of a Lisp is ability to define a new "special form" (without modifying the code of the interpreter) as a [reader] macro That's not fundamendal at all. If anything, either seldom used or frowned upon.
- deleted 12y ago[deleted]
- dschiptsov 12y agoSorry? The ability to add looping constructs and other control structures, like with* or defstruct/defmethod etc. to CL isn't fundamental for CL as a language? What is fundamental, then? And, please, don't tell me about the Lisp 1.5 - it was "fundamental" but has been evolved since then. btw, if you really do look inside arc.arc you will see "a bunch of nested macros".) This approach, championed by pg (or rather rtm) and described in the classic On Lisp book is, in some sense, the culmination of the few selected ideas behind a Lisp - you evolve the language as your understanding of the project deepens (evolves) by hacking appropriate DSL as you go. It is not just a "book stuff" - Arc is very real thing and this very site has been built very quickly (and cheap) using this very approach with very few lines of clean, readable code. Ironically, we are using these pages to discuss "religious nonsense" such OO-is-the-only-way, Java-is-the-proper-everything, Scrum-is-the-way-to-manage-big-projects, or "sectarian stuff" like Javascript.)
- lispm 12y agoWell, one can get quite far without writing macros. SICP for example writes (almost) no macros. Norvig himself has written only a few macros for his book PAIP.
- dschiptsov 12y agoYeah, having high-order functions gives you the ability to write "a primitive" DSL, which is the one of the big ideas from SICP. The limitation is that all the arguments to your high-order function will be evaluated before its application, so if you need a special form (with its own evaluation rule) you have to write a "short-circuiting" macro transformation. This is how to write "advanced" DSLs. Almost a 2/3 of Arc are macros, but, yes, there are very few "special forms" among them. As for PAIP, he loves structs and looping DSLs, while, at least for me, the beauty is hidden in explicit recursive calls for traversing a recursive data-structures (lists, trees, graphs) made out of conses. I'm Brian Harvey's man.)
- abecedarius 12y agohttp://norvig.com/lispy2.html http://norvig.com/lispy2.html does support macros.
- dschiptsov 12y agoThis one is better, indeed.) My point wasn't about mr.Norvig's essays - they are extraordinary and elegant, my point was about what is a toy [Lisp] and what isn't.)