[plt-scheme] Macros in the same module
On Thu, May 7, 2009 at 8:15 PM, Carl Eastlund <carl.eastlund at gmail.com> wrote:
> 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?
>
Very interesting. If I search for it as a first time it didn't find
it. I search for another thing directly on the search box and it found
it. Then I replaced the search box for define-for-syntax and also
found it. Wierd stuff. At least now I can see it.
Cheers!
> --
> Carl Eastlund
>
--
Paulo Jorge Matos - pocmatos at gmail.com
Webpage: http://www.personal.soton.ac.uk/pocm