Subject: Re: #. read macro in ctoi
From: (Rob Warnock)
Date: Wed, 26 Mar 2003 02:22:52 -0600
Newsgroups: comp.lang.lisp
Message-ID: <>
Christopher C. Stacy <> wrote:
|  Mark Jeffcoat ("Mark") writes:
|  Mark> (defun ctoi (d) 
|  Mark>   (- (char-code d) #.(char-code #\0)))
|  Mark> I do not understand what the "#." is doing there.
| He wants to subtract a constant, and just writing the call to
| CHAR-CODE would mean computing the constant every time the function
| was called.  Assuming that the compiler was not smart enough to notice
| that this was a constant expression, he used the #. macro to ask that
| the call be done at compile-time.

Oops! I'm sure this was just a slip o' the keyboard typo, Christopher,
but for Mark's sake we should be clear that that the evaluation is
occurring not at compile time but at *read* time, and thus is also
available in the REPL (as well as in interpreted code, if such a thing
exists in one's implementation):

	> '(- (char-code d) #.(char-code #\0))

	(- (CHAR-CODE D) 48)

Mark, see CLHS " Sharpsign Dot" <URL:


Rob Warnock, PP-ASEL-IA		<>
627 26th Avenue			<URL:>
San Mateo, CA 94403		(650)572-2607