[plt-scheme] Nested macros and (... ...)

From: Chongkai Zhu (czhu at cs.utah.edu)
Date: Thu Mar 5 11:37:36 EST 2009

James Coglan wrote:
>
>
> 2009/3/5 Chongkai Zhu <czhu at cs.utah.edu <mailto:czhu at cs.utah.edu>>
>
>     James Coglan wrote:
>
>
>         Am I right in thinking that (... ...) is a way of placing a
>         literal ... in the expansion without it being treated as a
>         repetition pattern by the first expansion?
>
>
>     Yep.
>
>
>
> Cool, thanks. Is this peculiar to PLT, or is it more widely used? Also 
> (and I realise this may be contrived), if you were to nest macros 
> three or more levels deep, how would you escape the '...' at each 
> level of nesting?
>

This is also true for R6RS.

You should read 
http://www.r6rs.org/final/html/r6rs/r6rs-Z-H-14.html#node_sec_11.19

=====

A template of the form (<ellipsis> <template>) is identical to 
<template>, except that ellipses within the template have no special 
meaning. That is, any ellipses contained within <template> are treated 
as ordinary identifiers. In particular, the template (... ...) produces 
a single ellipsis, .... This allows syntactic abstractions to expand 
into forms containing ellipses.

......

=====

So (... (... ...)) is a ellipsis for three nest macros.

Chongkai



Posted on the users mailing list.