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