Re: Ellipsis in the _pattern_
bear 11 Oct 2003 00:53 UTC
On Fri, 10 Oct 2003, Taylor Campbell wrote:
>Since with this SRFI it becomes possible to put literal ellipsis in the
>_template_, it seems like it would be useful to also be able to match
>literal ellipsis in the _pattern_, while still being able to use
>ellipsis
>to match multiple inputs. However, I cannot think of a nice and concise
>way to do this: enabling literal ellipsis to be present in the literal
>identifier list would prohibit the macro from using ellipsis to match
>multiple inputs. Any comments on this idea, and how to go about it?
It would certainly be possible to do it using an additional identifier;
An "obvious" choice, which is a legal identifier according to R5RS,
would be ::: . Other "obvious" choices which are legal identifiers
include <...> or /.../ . The first of those two is particularly tasty
because it allows a general "nested" syntax; you could use
<<...>>, <<<...>>>, etc, for more layers of nesting.
One thing to remember though, is that an ellipsis matches anything
in the code it's matching against -- including another ellipsis.
So there may actually be no issue here.
Bear