Skip to content

Instantly share code, notes, and snippets.

@gfredericks
Created September 3, 2012 17:46
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 gfredericks/3611284 to your computer and use it in GitHub Desktop.
Save gfredericks/3611284 to your computer and use it in GitHub Desktop.
eval-let
(defmacro eval-let
[lettings code]
(let [pairs (partition 2 lettings)]
`(eval (list `let [~@(apply concat (for [[name val] pairs] [(list 'quote name) val]))] ~code))))
;; (eval-let [a 14 b 48] '(+ a b)) => 62
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment