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