The Nature of Lisp
defmacro.org
The Nature of Lisp
1–10 of 82 posts
Re: The Nature of Lisp
#2Re: The Nature of Lisp
#3But I wouldn't recommend using Lisp itself.. macros in particular are unhygienic.
Re: The Nature of Lisp
#4I found that a rather good introduction to code as data, but I am not sure whether I am supposed to have been hit by the enlightenment he describes… :-)
"oh cool, it makes (+ 2 2) exactly equivalent to the syntaxic tree
+
/ \
2 2
"But I don't find it particularly enlightening and I still don't see what cool stuff you can do with macros that you can't do elsewhere.
Re: The Nature of Lisp
#5To understand Lisp is to understand interpreters. With that understanding you can create domain specific languages which is extremely powerful. But I wouldn't recommend using Lisp itself.. macros in particular are unhygienic.
Re: The Nature of Lisp
#6To understand Lisp is to understand interpreters. With that understanding you can create domain specific languages which is extremely powerful. But I wouldn't recommend using Lisp itself.. macros in particular are unhygienic.
Re: The Nature of Lisp
#7I found that a rather good introduction to code as data, but I am not sure whether I am supposed to have been hit by the enlightenment he describes… :-)
Yes, for me the first time I read about the lisp syntax I was thinking: "oh cool, it makes (+ 2 2) exactly equivalent to the syntaxic tree + / \ 2 2 " But I don't find it particularly enlightening and I still don't see what cool stuff you can do with macros that you can't do elsewhere.
In languages with macros, you don't need to wait for anyone to change the language because the entirety of the language is constructed from a few special operators, and you have the ability to continue constructing.
Like Python, Clojure has a "with-open" macro. If Rich hadn't already added it, you could build it yourself:
; Very simplified version
(defmacro with-open [bindings & body]
`(let ~bindings
(try
~@body
(finally (.close ~(first bindings))))))
Thus this: (with-open [in (reader "/usr/share/dict/words")]
(count (line-seq in)))
Expands into this: (clojure.core/let [in (reader "/usr/share/dict/words")]
(try
(count (line-seq in))
(finally (.close in))))Re: The Nature of Lisp
#8To understand Lisp is to understand interpreters. With that understanding you can create domain specific languages which is extremely powerful. But I wouldn't recommend using Lisp itself.. macros in particular are unhygienic.
Common Lisp != Lisp. You mean Common Lisp, Lisp is the family of languages (which also includes the Scheme sub-family, Racket, Clojure, Arc, Kernel…).
So yes I equate Lisp with common lisp. I didn't read the entire article (far too long) but he does mention 'defmacro' which is in Common Lisp.
Re: The Nature of Lisp
#9A really great book that helps you get appreciate the concepts in Lisp, without really talking about Lisp directly too much, is "Patterns of Software" by Peter Gabriel. http://amzn.to/TxDKGG
I found it to be a very enlightening read. Definitely a book you have to sink into with plenty of time and quiet.
Re: The Nature of Lisp
#10To understand Lisp is to understand interpreters. With that understanding you can create domain specific languages which is extremely powerful. But I wouldn't recommend using Lisp itself.. macros in particular are unhygienic.