[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Help in writing infix macro in CL.
Date: Tue, 6 May 1986 08:52 EDT
From: "Scott E. Fahlman" <Fahlman@C.CS.CMU.EDU>
I don't think that you can write an infix reader just by defining new
character macros for #\+ and friends. This new reader needs to get at
the whole expression, either because it is caled directly by your
program or because it is invoked when you see that first #\(, assuming
that all your top-level expressions are parenthesized. Of course, the
new reader can be built using the old one, or more specialized built-in
functions, to do most of the work, but it can't wait until you hit an
infix operator before it gets invoked.
In Zetalisp and Symbolics Common Lisp (and probably other MIT-derived
LispM dialects), there is a sharp-sign macro (altmode/lozenge) that
invokes the infix reader. Therefore (lozenges changed to dollar signs):
(equal '#$ a+b $ '(+ a b)) => T