[r6rs-discuss] Editorial change to 9.20 Macro transformers

From: David Van Horn <dvanhorn>
Date: Tue, 26 Jun 2007 17:34:32 -0400 (EDT)

On Tue, 26 Jun 2007, [ISO-8859-1] Jens Axel S?gaard wrote:
> AndrevanTonder wrote:
> > On Tue, 26 Jun 2007, David Van Horn wrote:
> >
> >> Also, it may be helpful to demonstrate the (<ellipsis> <template>) form if
> >> there is a succinct example. If not, a citation to an extended example
> >> might be appropriate. I know that Krishnamurthi's "Automata via Macros"
> >> JFP paper includes an example of (... ...). I'm sure there are others.
> >
> > The example definition of identifier-syntax in 12.8 contains such a use.
>
> The be-like-begin example from page 26 in Dybvig's "Writing hygienic
> macros in Scheme with syntax-case" is the most succint example I know.
>
> Slightly rewritten:
>
> (define-syntax (be-like-begin stx)
> (syntax-case stx ()
> [(be-like-begin name)
> #'(define-syntax (name stx)
> (syntax-case stx ()
> [(name expr (... ...))
> #'(begin expr (... ...))]))]))
>
> (be-like-begin sequence)
> (sequence 1 2 3 4) ;=> 4

This can easily be rewritten to syntax-rules which I think would be a nice
example to include in 9.20.

David
Received on Tue Jun 26 2007 - 17:34:32 UTC

This archive was generated by hypermail 2.3.0 : Wed Oct 23 2024 - 09:15:01 UTC