Can a macro be written in Scheme (with define-syntax
, for example) which will take expressions like this:
(op a b c d e f g h i j)
And yield expressions like this as output?
(op (op (op (op (op (op (op (op (op a b) c) d) e) f) g) h) i) j)
Of course, for arbitrary lengths. I can't think of a way to do it, given some template like this:
(define-syntax op
(syntax-rules ()
[(_) 'base-case]
[(v1 v2 ...) 'nested-case??]))