allow rest param in let-optionals

This commit is contained in:
Alex Shinn 2019-10-14 22:04:23 +08:00
parent 58e10b2a7d
commit f4b0277d01
2 changed files with 8 additions and 2 deletions

View file

@ -16,6 +16,12 @@
((opt-lambda (a (b 11) (c 12))
(list a b c))
0))
(test '(0 1 (2 3 4))
(let-optionals* '(0 1 2 3 4) ((a 10) (b 11) . c)
(list a b c)))
(test '(0 1 (2 3 4))
(let-optionals '(0 1 2 3 4) ((a 10) (b 11) . c)
(list a b c)))
(test-error '(0 11 12)
((opt-lambda (a (b 11) (c 12))
(list a b c))))

View file

@ -51,8 +51,8 @@
(define-syntax let-optionals
(syntax-rules ()
((let-optionals ls ((var default) ...) body ...)
(let*-to-let let-optionals* ls () ((var default) ...) body ...))))
((let-optionals ls ((var default) ... . rest) body ...)
(let*-to-let let-optionals* ls () ((var default) ... . rest) body ...))))
;;> \macro{(let-optionals* ls ((var default) ... [rest]) body ...)}
;;>