[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Help in writing infix macro in CL.
Date: Mon, 5 May 86 16:27:46 PDT
From: "S. Sridhar" <sridhar%tekecs%tektronix.csnet@CSNET-RELAY.ARPA>
Subject: Help in writing infix macro in CL.
Is there a way to do the following using the reader macro functions
of CLtL ?
I want to have a reader macro that translates
(a + b) to (+ a b). How can I remember the lisp object that was read
before the macro character #\+.
I would appreciate some pointers.
As Scott pointed out, there is no way in CL to access what has been
read prior to the execution of a read-macro. To do what you want, you
would have to redefine the read-macro for #\( to save the elements
seen so far in a list that is manipulatable via a global variable. A
less ambitious approach might be to use [...] around infix
expressions; then you wouldn't have to worry about breaking (...).