[plt-scheme] a simple macro (fwd)
Hi Michael,
[Please use Reply-To-All since you probably want to ask this to the list.
I'm still a newcomer to PLT Scheme and am likely to give non-optimal
answers.]
It's perfectly possible to write a function for use in both contexts, but
from my best understanding, PLT's system requires you to put that function
in a dedicated module in order to reuse it.
Once there, you can either say:
(require "some-module.ss")
or:
(require-for-syntax "some-module.ss")
to pull that function definition for the specific phase context you want.
Take a closer look at that Composable and Compilable Macros paper: it goes
through a nice example that talks about this in some detail.
By the way, here's another set of slides that are aimed as introductory
Scheme macro material:
http://www.cs.utah.edu/plt/slideshow/macro-slides/talk.pdf
---------- Forwarded message ----------
Date: Tue, 21 Nov 2006 18:09:58 -0800 (PST)
From: michael rice <nowgate at yahoo.com>
To: Danny Yoo <dyoo at hkn.eecs.berkeley.edu>
Subject: Re: [plt-scheme] a simple macro
Do I have to have two function definitions, one
regular and one for syntax?
Michael
Welcome to DrScheme, version 360.
Language: Swindle.
> (fun 4)
. reference to undefined identifier: fun
> (mac 4)
10
>