Subject: Re: Programmer interested in learning LISP (or not?) - recommendation?
From: rpw3@rpw3.org (Rob Warnock)
Date: Sun, 01 Feb 2004 05:10:00 -0600
Newsgroups: comp.lang.lisp
Message-ID: <f-qcnfQhuY0VQ4HdXTWc-w@speakeasy.net>
Adam Warner  <usenet@consulting.net.nz> wrote:
+---------------
| For bonus points the author could point out that #\! is a character
| reserved for the user.
| 
| (set-macro-character #\! (lambda (s c) (declare (ignore c))
|                            (fac (read s t nil t))))
| 
| !10, while read as "the factorial of 10" instead of "10 factorial" is
| still tidy syntax.
+---------------

And of course, if you really just *had* to have "10 factorial"
you could always define it as a dispatching macro character:

	> (set-dispatch-macro-character #\# #\!
	    (lambda (s c n)
	      (declare (ignore s c))
	      (fac n)))
	#<Interpreted Function>
	> #10!
	3628800
	> 


-Rob

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607