Skip to content

Instantly share code, notes, and snippets.

@SaitoAtsushi
Created February 17, 2011 11:05
Show Gist options
  • Save SaitoAtsushi/831505 to your computer and use it in GitHub Desktop.
Save SaitoAtsushi/831505 to your computer and use it in GitHub Desktop.
(define-syntax let-optionals*
(syntax-rules ()
((_ a ((v d) . r) . b)
(let* ((t a)
(v (if (null? t) d (car t))))
(let-optionals* (if (null? t) '() (cdr t)) r . b)))
((_ a () . b)
(begin . b))
((_ a (v . r) . b)
(let-optionals* a ((v #f) . r) . b))
((_ a rv . b)
(let ((rv a)) . b))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment