Skip to content

Instantly share code, notes, and snippets.

@jjl
Created July 8, 2016 14:17
Show Gist options
  • Save jjl/c76692d47981dbfd6d495b12063180dc to your computer and use it in GitHub Desktop.
Save jjl/c76692d47981dbfd6d495b12063180dc to your computer and use it in GitHub Desktop.
(defn reexport [ns sym]
(cond (not (symbol? sym)) (throw (ex-info "reexport takes a symbol!" {}))
(not (namespace sym)) (throw (ex-info "reexport takes a namespaced symbol" {}))
:else
(let [v (resolve sym)]
(intern ns (-> sym name symbol (with-meta (meta v))) @v))))
@jjl
Copy link
Author

jjl commented Jul 8, 2016

sample usage:

(doseq [n `[foo/bar baz/quux]]
  (reexport *ns* n))

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