[plt-scheme] Another macro venture

From: Robby Findler (robby at cs.uchicago.edu)
Date: Sat Sep 9 12:50:12 EDT 2006

Maybe you should consider using boxes instead of variables, if that's
the behavior you want.

Robby

At Sat, 09 Sep 2006 10:38:07 -0500, Blake McBride wrote:
> 
> Greetings,
> 
> I now embark on yet another macro venture.  I've already spent
> an hour on it.  I know I can figure it out eventually, but I figured
> it's easier to ask than spend the rest of my morning on this.
> 
> Semi-curiously, scheme functions evaluate their arguments but
> set! and define don't evaluate their first arguments.  I understand
> that it's convenient that they don't, but it is inconsistent.  One of
> the main attractions of scheme is the fact that it treats (what other
> languages think of) variables and functions consistently and
> without requiring any extra syntax (like lisp).  set! and define
> seem inconsistent.  Lisp set (not setq) is more generic and
> valuable at times.
> 
> I know you need a macro system to create a lisp-like set in scheme.
> It should work (for those unfamiliar with lisp set) like the following:
> 
> (define a 'b)
> (set a 5)
> 
> now:
> 
> a -> b
> b -> 5
> 
> Since set evaluated its first argument (which evaluates to b), it set b to 5.
> 
> I'm trying to create a scheme set macro which works the same using
> define-syntax and syntax-case.  I presume syntax-rules cannot do this.
> 
> Again, all this is trivial to express in a lisp-like macro system and the
> few capture situations are easy to avoid with a little care.
> 
> Your help is appreciated.
> 
> Blake McBride
> 
> 
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme


Posted on the users mailing list.