Common Lisp Reader Macros: A Simple Introduction
dorophone.blogspot.com
dorophone.blogspot.com
Imagine if your favorite programming language, X, had some sort of facility to expose a function/method's Abstract Syntax Tree and a meta-language for scripting changes to particular patterns of in the AST or activating different functionality. Well, in Lisp, the language is also it's own Abstract Syntax Tree and it's own meta-language.
(I use a Smalltalk meta-language all the time at work for code transformation, but even with such a facility Smalltalk can't quite do everything Lisp macros can do.)
I found it to be a great resource on a topic that is often ignored by people coming to Common Lisp.
(defvn square (x)
(* x x))
and get both (square 3) => 9 and (square #(1 2 3)) => #(1 4 9). This is not hard; to show off the short paste at http://paste.lisp.org/+24PP one needs a fancier example (defvn times (&rest v)
(reduce #'* v))
lets (times 2 3 5) => 30, (times #(2 3) 5) => #(10 15), and (times #(1 10 100) 2 #(3 5 7) 0.1) => #(0.6 10.0 140.0)