Skip to content

Instantly share code, notes, and snippets.

@RutledgePaulV
Created January 2, 2019 02:27
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 RutledgePaulV/5e8157bb55a1261af41e4815702ed810 to your computer and use it in GitHub Desktop.
Save RutledgePaulV/5e8157bb55a1261af41e4815702ed810 to your computer and use it in GitHub Desktop.
let-from-map.clj
(defmacro evaluate* [bindings & code]
(letfn [(eval-with-bindings [bindings code]
(let [ks (keys bindings)]
((eval `(fn [{:syms [~@ks]}] ~code)) bindings)))]
`(~eval-with-bindings ~bindings '(do ~@code))))
@RutledgePaulV
Copy link
Author

(evaluate* {'plus +} (plus 5 6))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment