[plt-scheme] simple macro

From: Eli Barzilay (eli at barzilay.org)
Date: Thu Mar 3 11:19:33 EST 2005

On Mar  3, djneu at att.net wrote:
> Eli,Joe,
> 
> Thanks for the help.
> 
> After Eli's message I decided to go with the
> approach Joe's suggested.

Joe's approach is cleaner, but now you can use a simple procedure
which will be even easier to follow.  The only thing you need to add
is a quote to places that use it.


>  -------------- Original message ----------------------
> From: Joe Marshall <jrm at ccs.neu.edu>
> > As will passing ARGS in to the macro:
> > 
> >  (define-syntax init
> >    (syntax-rules ()
> >      ((_ sym def args) (cond ((assq (quote sym) args) => cadr)
> >                              (else def)))))
> > 
> >  (define f
> >    (lambda (x . args)
> >      (let  ((y (init y 2 args)))
> >        (printf "x=~a y=~a~n" x y))))

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!



Posted on the users mailing list.