[plt-scheme] redefining set!

From: Jens Axel Søgaard (jensaxel at soegaard.net)
Date: Mon Jun 18 18:10:59 EDT 2007

Hans Oesterholt-Dijkema skrev:
> Hmm,
> If instead of defining a procedure, I'd define a
> macro, I would be able to do

> (define x (cl 5))
> instead of  (define-instance x (cl 5))

The macro define-instance receives both x and cl,
and can thus record that x is an instance of
the class cl.


   (define x (cl 5)

the macro call (cl 5) doesn't receive the x,
and thus can't record that x is a cl class.

> However. How can I create a result that will
> be able to be called like a macro. I cannot return
> a macro as a value can I?

No, not at runtime.

> So I can associate cl with m alright. 


> But that would require defining something like:
> cl->
> wouldn't it?
> And then, "transforming" (-> x m 8) to something like
> (cl-> x m 8). However, how can I turn -> into cl->?

In def-class you need to record that cl is associated
with cl-> . There is a record example in

   Composable and Compilable Macros

that might be used for inspiration.

Jens Axel Søgaard

Posted on the users mailing list.