Let’s say I have the following macro in R5RS Scheme:
(define-syntax pair-test
(syntax-rules ()
((_ (a b . c))
(quote (a b . c)))))
The macro transforms an input pair to an output pair, as one would expect:
(pair-test (1 2 . 3))
==> (1 2 . 3)
I can also pass a list to the macro, as allowed by the spec. However, the output is a list instead of a pair:
(pair-test (1 2 3))
==> (1 2 3)
What exactly is going on here? Why is the output a list instead of a pair?
Could
cbe(3 . ())in the second case? I’m not positive but that would make sense to me. And then quoting(a b . c)would be(1 2 . (3 . ()))which is(1 2 . (3))and(3)is a proper list, so(1 2 3)?