[pro] Reader macro definition in CLHS

Martin Simmons martin at lispworks.com
Wed Mar 2 19:45:12 UTC 2011


>>>>> On Wed, 02 Mar 2011 07:48:34 +0100, Kazimir Majorinc said:
> 
> -------------------
> reader macro n. 1. a textual notation introduced by dispatch on one or
> two characters that defines special-purpose syntax for use by the Lisp
> reader, and that is implemented by a reader macro function. See Section
> 2.2 (Reader Algorithm). 2. the character or characters that introduce a
> reader macro[1]; that is, a macro character or the conceptual pairing of
> a dispatching macro character and the character that follows it. (A
> reader macro is not a kind of macro.)
> -------------------
> 
> I do not understand item 1. In code
> 
> ...
> (set-macro-character #\G (lambda(s c) 9.81))
> (setf s (* (/ G 2) (* tt tt)))
> 
> #\G is the reader-macro in a sense 2. What is the reader-macro in
> a sense 1.?

There is no difference in that simple case, but consider the standard
Sharpsign X case:

#X123 is the reader macro in sense 1
#X is the reader macro in sense 2

I.e. sense 2 describes the characters that the built-in reader algorithm
processes and sense 1 contains those characters plus anything that the reader
macro function reads.

-- 
Martin Simmons
LispWorks Ltd
http://www.lispworks.com/




More information about the pro mailing list