Scheme Macro for nesting expressions
问题 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??])) 回答1: (define bop list) (define-syntax op (syntax-rules () ((op a b) (bop a b