[pro] Reader macro definition in CLHS
------------------- 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.? Kazimir Majorinc
Kazimir Majorinc <kazimir@chem.pmf.hr> writes:
------------------- 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.?
G When you write (/ G D), G is a reader macro, D is a symbol. -- __Pascal Bourguignon__ http://www.informatimago.com/ A bad day in () is better than a good day in {}.
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/
participants (3)
-
Kazimir Majorinc
-
Martin Simmons
-
Pascal J. Bourguignon