[plt-scheme] Null syntax / Conditional definition

From: Doug Orleans (dougo at place.org)
Date: Sat Jun 18 12:05:02 EDT 2005

Chihiro Kuraya writes:
 > Jordan Johnson <jorjohns at cs.indiana.edu> wrote:
 > > On Saturday, June 18, 2005, at 05:39  AM, Chihiro Kuraya wrote:
 > > > (1) Is it possible to define syntax or syntax-id
 > > > which disappears when expanded ?
 > > 
 > > To answer your first question:
 > > 
 > > (define-syntax my-append
 > >    (syntax-rules ()
 > >      ((_ s1 (discard s2))
 > >       (string-append s1 s2))
 > >      ((_ s1 discard s2)
 > >       (string-append s1 s2))))
 > > 
 > > (my-append "pqr" ABC "xyz")
 > > (my-append "pqr" (ABC "xyz"))
 > 
 > What I want to do is defining ABC macro
 > which is not specific to string-append.
 > 
 > For example, I want also (list 123 ABC 456)
 > to be expanded to (list 123 456).

I think you could redefine the primitive "#%app" syntax to remove "ABC"
from all application expressions.  But this wouldn't remove it from
other syntax, e.g. "and".

--dougo at place.org



Posted on the users mailing list.