Skip to content

Instantly share code, notes, and snippets.

(define-syntax let-optionals
(syntax-rules ()
((_ args ((var default) rest ... . restarg) body ...)
(let* ((tmp args)
(var (if (null? tmp) default (car tmp))))
(let-optionals (if (null? tmp) '() (cdr tmp))
(rest ... . restarg)
body ...)))
((_ args () body ...)
(begin body ...))