[racket] Need help with macro...

From: FS Racket (fsracket at gmail.com)
Date: Sun Feb 12 15:09:36 EST 2012

On Sun, Feb 12, 2012 at 1:34 PM, Richard Cleis <rcleis at me.com> wrote:

> The DrRacket interactions window replies with 48, not an error, when your
> syntax is defined in the definitions window, your function is defined in
> the interactions area, and the example is finally run in the interactions
> area.
>
> How are you making it fail?
>
> Also, have you attempted to use the Macro Stepper? Even if you aren't
> actually debugging the macro, it coerces you to organize your thoughts
> about how your code is organized (in this case, how the expansion relates
> to the word 'mult' and it's actual definition.)
>
> rac
>
>
Hi Richard,

Good questions.

The way my code is organized is that the macro is in its own file and
installed as a collection in my personal library (i.e. the default location
of personal collections).  I then create a new file, say "test.rkt",
require the macro library file, and then define the function "mult".
 Within this same file, I then add the code examples contained in my
previous email.  Finally, I "run" the "test.rkt" file using the "Racket ->
Run" menu option.

Yes, I have used the macro stepper; I should have mentioned that.  It's
bizarre.  Prior to any expansion, all identifiers named 'mult' have an
associated binding.  As I step through the expansion in the following code,
the last 'mult' eventually loses its binding.  I don't know how or why.

(==>
 (mult 12 2)
 (mult 2 _)
 (mult _ 1))

Please let me know if any further clarification is needed.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20120212/8346ae44/attachment.html>

Posted on the users mailing list.