In syntax-rules, we use pattern language. What the pattern language? I want to write (\ x y -> ...)
rather than (lambda (x y) ...)
also in scheme. So I write the following macro.
(define (split ls)
(if (eq? (car ls) '->) (values '() (cdr ls))
(receive (a b) (split (cdr ls)) (values (cons (car ls) a) b))))
(define-macro (^ . ls)
(receive (args body) (split ls)
`(lambda ,args ,@body)))
this works.
(define f (^ x y z -> (* (+ x y))))
(f 1 2 3) ; => 9
(define-syntax ^
(syntax-rules (->)
((^ x ... -> body ...) (lambda (x ...) body ...))))
Gauche says "Bad ellipsis..."
I cannot beleave that pattern language is turing complete.
...
というキーワードはリストの一番最後の要素としてしか置けない