[plt-scheme] Macros in the same module

From: Carl Eastlund (carl.eastlund at gmail.com)
Date: Thu May 7 15:15:58 EDT 2009

On Thu, May 7, 2009 at 3:08 PM, Paulo J. Matos <pocmatos at gmail.com> wrote:
> On Thu, May 7, 2009 at 1:25 PM, Noel Welsh <noelwelsh at gmail.com> wrote:
>> I think you want a define-for-syntax not a define-syntax, or you need
>> to put 'expand-rules' into a (syntax ...). One macro can definitely
>> expand into another:
>>
>> #lang scheme/base
>>
>> (define-syntax foo
>>  (syntax-rules ()
>>    [(foo name val)
>>     (bar name val)]))
>>
>> (define-syntax bar
>>  (syntax-rules ()
>>    [(bar name val)
>>     (define name val)]))
>>
>> (foo a 42)
>> a
>>
>
> Hi Noel,
>
> Thanks, I knew that I could do that, but I am using syntax-case which
> I am not so familiar with given syntax-rules as been enough for me
> each time I need to define something more complex as a macro.
>
> Anyway, indeed, define-for-syntax works, but interestingly enough it
> doesn't show up anything when I search for it in the manual.
> http://docs.plt-scheme.org/search/index.html?q=define-for-syntax
>
> any idea why?

That's strange, I get two hits (define-for-syntax and
define-values-for-syntax).  Do you have Javascript disabled?  Do other
searches work for you?

-- 
Carl Eastlund


Posted on the users mailing list.