Skip to content

Instantly share code, notes, and snippets.

@josephwilk
Last active December 12, 2015 02:28
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 josephwilk/4698595 to your computer and use it in GitHub Desktop.
Save josephwilk/4698595 to your computer and use it in GitHub Desktop.
(defn gen-fn
[n as b]
(let [n (symbol n)
as (vec (map symbol as))
fn-value (eval `(fn ~n ~as ~b))]
(intern *ns* n fn-value)))
(gen-fn "user" [] '(println "I'M BEING CALLED!"))
((resolve (symbol (name :user))))
(defn fail []
(gen-fn "userz" [] '(println "I'M BEING CALLED!"))
((resolve (symbol (name :userz)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment