-
-
Save jhickner/2066039 to your computer and use it in GitHub Desktop.
locals map
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 locals | |
"Returns a map of locals, as keywords, to their values." | |
[] | |
(let [locals (keys &env)] | |
`(zipmap ~@(map vec [(map keyword locals) locals])))) | |
(let [x 10] | |
(let [y 20 | |
z (+ x y)] | |
(locals))) | |
;=> {:x 10, :y 20, :z 30} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment