[plt-scheme] Another macro venture

From: Jens Axel Søgaard (jensaxel at soegaard.net)
Date: Sat Sep 9 13:47:51 EDT 2006

Hi Blake,

Blake wrote:
> 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.

Blake also wrote:
 > A solution to my unmolested and unqualified
 > problem would be a big help and greatly appreciated.

The first step of writting a macro is to figure out what the
expansion needs to be.

If you were to write your program in a Scheme dialect with
no macros, what would you write instead of

   (define a 'b)
   (set a 5)


Jens Axel Søgaard

Posted on the users mailing list.