Is is possible in Common LISP to tweak the reader such that a particular character is read as a macro character when it appears in certain contexts, but outside of these contexts the character retains its default syntax type (probably 'constituent')? For example, suppose I want the character #\! to be interpreted as a macro char iff it appears within a call to some macro I've defined. So
(macroexpand '(my-macro !(a b c))
=> (my-macro-expansion ... )
but
(setq x !(a b c))
=> Error: Odd number of arguments in (SETQ X ! (A B C))
--
*
Len Charest, Jr. ·······@ai-cyclops.jpl.nasa.gov
JPL Artificial Intelligence Group
*
In article <·····················@jpl-devvax.jpl.nasa.gov> ·······@AI-Cyclops.JPL.NASA.GOV writes:
>Is is possible in Common LISP to tweak the reader such that a particular character is read as a macro character when it appears in certain contexts, but outside of these contexts the character retains its default syntax type (probably 'constituent')? For
>example, suppose I want the character #\! to be interpreted as a macro char iff it appears within a call to some macro I've defined. So
>
> (macroexpand '(my-macro !(a b c))
>=> (my-macro-expansion ... )
>but
> (setq x !(a b c))
>=> Error: Odd number of arguments in (SETQ X ! (A B C))
As one followup stated, you really can't do what you want cleanly.
An alternative, however, would be to write your macros to all call a !convert
macro (or function) on each of the arguments.
This may be too much hassle...
--
"TANSTAAFL" ·····@aristotle.ils.nwu.edu