R5RS Macro Mysteries 
Author Message
 R5RS Macro Mysteries

I've started writing R5RS macros, so I can be informed in my
uninformed opinions about them :) They're not as bad as I thought, but
there is much that I still find mystifying. For Example:

(define-syntax define-noisy
   (syntax-rules ()
      ; this only matches a subset of the needed patterns
      ; but it's good enough for now
      ((define-noisy (name args ...) body ... )
       (define name
          (lambda (args ...)
             (display* "Noisy! entering: " name #\Newline)
             body ...)))))

This was part of some quick-and-dirty hacks I've been putting together
for debugging. When I use this at top-level under Bigloo, I get a
complaint about the define being in an incorrect context. Using the
other macro system in Bigloo:

(define-macro (define-noisy form . body)
   (let ((name (car form)))
      `(define ,form
          (display* "Noisy! entering: " ',name #\Newline)

which works fine. What am I missing about the standard macro here?

TIA,

david rush
--
From the start...the flute has been associated with pure (some might
say impure) energy. Its sound releases something naturally untamed, as
if a squirrel were let loose in a church." --Seamus Heaney



Sat, 06 Jul 2002 03:00:00 GMT  
 R5RS Macro Mysteries

Quote:

> I've started writing R5RS macros, so I can be informed in my
> uninformed opinions about them :) They're not as bad as I thought, but
> there is much that I still find mystifying. For Example:

> (define-syntax define-noisy
>    (syntax-rules ()
>       ; this only matches a subset of the needed patterns
>       ; but it's good enough for now
>       ((define-noisy (name args ...) body ... )
>        (define name
>      (lambda (args ...)
>         (display* "Noisy! entering: " name #\Newline)
>         body ...)))))

> This was part of some quick-and-dirty hacks I've been putting together
> for debugging. When I use this at top-level under Bigloo, I get a
> complaint about the define being in an incorrect context. Using the
> other macro system in Bigloo:

Probably Bigloo thinks that the define that is spitted out is not on
the top level and is therefore not allowed. In my opinion this should
work.

--
Antti Huima



Sat, 06 Jul 2002 03:00:00 GMT  
 R5RS Macro Mysteries
Antti Huima:

Quote:

> > for debugging. When I use this at top-level under Bigloo, I get a
> > complaint about the define being in an incorrect context. Using the
> > other macro system in Bigloo:

> Probably Bigloo thinks that the define that is spitted out is not on
> the top level and is therefore not allowed. In my opinion this should

You could try wrapping a BEGIN around the definition.  Maybe this
appeases the upset system.

rthappe



Sat, 06 Jul 2002 03:00:00 GMT  
 R5RS Macro Mysteries

Quote:

> I've started writing R5RS macros, so I can be informed in my
> uninformed opinions about them :) They're not as bad as I thought, but
> there is much that I still find mystifying. For Example:

> (define-syntax define-noisy
>    (syntax-rules ()
>       ; this only matches a subset of the needed patterns
>       ; but it's good enough for now
>       ((define-noisy (name args ...) body ... )
>        (define name
>      (lambda (args ...)
>         (display* "Noisy! entering: " name #\Newline)
>         body ...)))))

> This was part of some quick-and-dirty hacks I've been putting together
> for debugging.

scm (5c4) accepts this w/o complaint.

--
Matthew.R.Wette at jpl.nasa.gov -- I speak for myself, not for JPL.



Sat, 06 Jul 2002 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. implementing r5rs macros

2. R5RS and macros

3. R5RS macro problem

4. graphical frontend for Scheme R5RS Macros

5. How to write dirty R5RS macros

6. Capabilities of R5RS macros?

7. R5RS Macro Implementation

8. R5RS vs low-level macros: a case study of typing and expansion

9. R5RS Macro question

10. tricky question about R5Rs macros

11. r5rs macros which work with Gambit compiler

12. subtleties of r5rs macros

 

 
Powered by phpBB® Forum Software