All LISP resources seem to make reference to the incredible
reflexive power of LISP languages, without providing concrete
examples. I understand that LISP's reflexivity (or code-data duality,
or whatever you want to call it) is what makes metaprogramming
possible (thereby allowing a macro system, for example), however I
have not done enough LISP programming to have a feeling for the real
power of this, when it comes to programming large-scale applications.
Can anyone provide an example(s), or other ideas about the virtues
of reflexivity?
va1 wrote:
> All LISP resources seem to make reference to the incredible
> reflexive power of LISP languages, without providing concrete
> examples. I understand that LISP's reflexivity (or code-data duality,
> or whatever you want to call it) is what makes metaprogramming
> possible (thereby allowing a macro system, for example), however I
> have not done enough LISP programming to have a feeling for the real
> power of this, when it comes to programming large-scale applications.
> Can anyone provide an example(s), or other ideas about the virtues
> of reflexivity?
If you want to understand the basic idea of metacircularity, I can
recommend to read two papers:
- Paul Graham, The Roots of Lisp, http://www.paulgraham.com/rootsoflisp.html
- Guy Lewis Steele, Jr. and Gerald Jay Sussman. "The Art of the
Interpreter", http://library.readscheme.org/page1.html
If you want to get the idea of how macros work, I have tried to write an
"executive summary" in my Lisp Guide at
http://www.pascalcostanza/lisp/guide.html
But it's probably much better to read a good book that introduces Lisp
macros well. Try one of:
- Peter Norvig, Patterns of Artifical Intelligence Programming
- Paul Graham, On Lisp, http://www.paulgraham.com/onlisp.html
- Peter Seibel, Practical Common Lisp, http://www.gigamonkeys.com/book/
Metacircularity has also been applied to CLOS, the Common Lisp Object
System. Andreas Paepcke provides an excellent introduction:
- Andreas Paepcke, User-Level Language Crafting,
http://www-db.stanford.edu/~paepcke/shared-documents/mopintro.ps
And then make sure to read the following book at some stage.
- Gregor Kiczales, Jim des Rivieres, Daniel G. Bobrow, "The Art of the
Metaobject Protocol"
(but it's wise to get a decent understanding of CLOS first...)
Pascal
"va1" <·······@csd.uwo.ca> schrieb im Newsbeitrag
·····························@z14g2000cwz.googlegroups.com...
> All LISP resources seem to make reference to the incredible
> reflexive power of LISP languages, without providing concrete
> examples. I understand that LISP's reflexivity (or code-data duality,
> or whatever you want to call it) is what makes metaprogramming
> possible (thereby allowing a macro system, for example), however I
> have not done enough LISP programming to have a feeling for the real
> power of this, when it comes to programming large-scale applications.
> Can anyone provide an example(s), or other ideas about the virtues
> of reflexivity?
>
When I started learning Lisp I was as skeptical as you. Thought: "These
lispers don't lack self-consciousness". Now I think they are right. One of
the success stories is Paul Graham's former company ViaWeb (see
http://www.paulgraham.com/avg.html)
Andreas
va1 wrote:
> All LISP resources seem to make reference to the incredible
> reflexive power of LISP languages, without providing concrete
> examples. I understand that LISP's reflexivity (or code-data duality,
> or whatever you want to call it) is what makes metaprogramming
> possible (thereby allowing a macro system, for example), however I
> have not done enough LISP programming to have a feeling for the real
> power of this, when it comes to programming large-scale applications.
> Can anyone provide an example(s), or other ideas about the virtues
> of reflexivity?
Darius Bacon's "A Hackers Guide to Partial Evaluation" provide
a fine example of the program/data-duality:
<http://64.233.183.104/search?q=cache:T5tJp4-mwCEJ:www.lisp-p.org/htdocs/peval/peval.cgi+&hl=en>
Note that in stead of emitting code and then running it manually,
one can use macros to do this automatically.
--
Jens Axel Søgaard