[r6rs-discuss] Is this pattern matching behavior allowed by R6RS or not?
R. Kent Dybvig
dyb at cs.indiana.edu
Fri Feb 15 16:35:07 EST 2008
> Is this allowed according to the R6RS:
> (syntax-case #'123 ()
> [(x* ... . r)
> (syntax->datum #'r)])
> => 123
> Which for this behavior, I read the critical parts as "... if and only
> if ... F is a list or improper list ... whose ... final cdr matches Px".
If I understand the issue, I think this boils down to asking whether 123
is considered an improper list and, if so, whether its last cdr is 123.
Right? If so, I can tell you that such was the intended interpretation.
It would have been better to make this intention more clear. That 123
qualifies as an improper list is consistent with the definition of
improper list given in Section 11.9 as "a chain of pairs not ending in the
empty list", assuming such a chain can be empty. It is also consistent
with the usage of the term in the description of append. But it's
questionable whether an empty chain of pairs can have a "last cdr".
More information about the r6rs-discuss