Created
November 16, 2011 16:09
-
-
Save scgilardi/1370491 to your computer and use it in GitHub Desktop.
a variant of let that provides access to all the bindings
This file contains 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
; works in a simple test case, hasn't seen any other testing | |
(defmacro environment | |
"Expands to code that generates a map of locals: names to values" | |
[] | |
`(zipmap '~(keys &env) [~@(keys &env)])) | |
(defmacro visible-let [argv & body] | |
`(let [~@ argv | |
~'&bindings (environment)] | |
~@body)) | |
user> (visible-let [a 1 b 2] &bindings) | |
{a 1, b 2} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment