Newsgroups: comp.lang.lisp
Path: cantaloupe.srv.cs.cmu.edu!rochester!cornellcs!travelers.mail.cornell.edu!news.kei.com!news.mathworks.com!uunet!in2.uu.net!harlequin.com!epcot!usenet
From: norvig@meteor.menlo.harlequin.com (Peter Norvig)
Subject: Re: self-evaluating non-atomic forms
In-Reply-To: bhorowit@kerits.cs.umass.edu's message of 6 Oct 1995 18:06:10 GMT
Message-ID: <NORVIG.95Oct10111635@meteor.menlo.harlequin.com>
Lines: 28
Sender: usenet@harlequin.com (Usenet Maintainer)
Nntp-Posting-Host: meteor.menlo.harlequin.com
Organization: Harlequin Inc, Cambridge, MA
References: <453r6i$448@kernighan.cs.umass.edu>
Date: Tue, 10 Oct 1995 18:16:35 GMT


It is useful to distinguish between self-evaluating (the output is
equal to the input) and self-reproducing (the printed output looks
like the input).  In ANSI CL, lambda is a macro, so the following is
self-reproducing in a CL that prints functions as their source code:

((lambda (x) (list x x))
 (lambda (x) (list x x)))

My favorite example is only seven characters:

#1='#1#

This is self-evaluating, but only self-reproducing when *print-circle*
is true.  So you can do:

#1=(setq *print-circle* '#1#)

Marty Hall pointed out that the variable - can be used, but he missed
a twelve character solution:

(identity -)

-- 
Peter Norvig                  | Phone: 415-833-4022           FAX: 415-833-4111
Harlequin Inc.                | Email: norvig@harlequin.com
1010 El Camino Real, #310     | http://www.harlequin.com
Menlo Park CA 94025           | http://www.cs.berkeley.edu/~russell/norvig.html
