Created
March 19, 2015 01:40
Example of Scheme's named let in action
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmacro nlet (name bindings &body body) | |
"This is the LET from RnRS with a name, that creates a local function." | |
`(labels ((,name ,(mapcar #'first bindings) ,@body)) | |
(,name ,@(mapcar #'second bindings)))) | |
(nlet foo ((count 5)) | |
(unless (= 0 count) | |
(print count) | |
(foo (1- count)))) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment