Skip to content

Instantly share code, notes, and snippets.

@kephas
Created March 19, 2015 01:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kephas/5e98c00a209df6a9a5f0 to your computer and use it in GitHub Desktop.
Save kephas/5e98c00a209df6a9a5f0 to your computer and use it in GitHub Desktop.
Example of Scheme's named let in action
(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