[r6rs-discuss] Editorial change to 9.20 Macro transformers

From: Jens Axel Søgaard <jensaxel>
Date: Tue, 26 Jun 2007 23:30:01 +0200

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

-- 
Jens Axel S?gaard
Received on Tue Jun 26 2007 - 17:30:01 UTC

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