Ticket #1736: test.scm

File test.scm, 642 bytes (added by Vasilij Schneidermann, 3 years ago)
Line 
1(import (chicken base))
2
3(define-syntax let-optionals*
4  (syntax-rules ()
5    ((_ expr (binding ... . rest))
6     '((expression expr)
7       (bindings binding ...)
8       (other . rest)))))
9
10(print
11 (let-optionals* _
12                 ((foo 1)
13                  (bar 2)
14                  . baz)))
15;; Error: during expansion of (syntax-rules ...) - Cannot combine dotted tail and ellipsis: (binding ... . rest)
16
17(define-syntax apply-syntactic-continuation
18  (syntax-rules ()
19    ((apply-syntactic-continuation (?k ?env ...) . ?args)
20     (?k ?env ... . ?args))))
21
22(print (apply-syntactic-continuation (list 1 2 3) 4 5 6))
23;; (list 1 2 3 4 5 6)