(define-syntax test
(syntax-rules ()
((test (a ...) (b ...))
(quote ((a b) ...)))))
What happens if one calls this macro on two lists of different
lengths? According to various online tutorials, the expansion should
abort with an error. In current hygienic Chicken the behaviour
depends on which list ends first:
(test (1 2) (10 20 30))
=> ((1 10) (2 20))
(test (1 2 3) (10 20))
Error: (map) during expansion of (test ...) - lists are not of same
length: (())
R5RS is pretty vague, but does hint at an error condition in the last
sentence:
"Pattern variables that occur in subpatterns followed by one or more
instances of the identifier ... are allowed only in subtemplates that
are followed by as many instances of .... They are replaced in the
output by all of the subforms they match in the input, distributed as
indicated. It is an error if the output cannot be built up as
specified."
Tobia
_______________________________________________
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users