Skip to content

Instantly share code, notes, and snippets.

@arohner
Created February 7, 2013 22:41
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 arohner/4734884 to your computer and use it in GitHub Desktop.
Save arohner/4734884 to your computer and use it in GitHub Desktop.
(defn resolve-map-fn
"given a record type, resolve and return it's map->Foo fn"
[record-class]
(let [simple-name (.getSimpleName record-class)
full-name (.getName record-class)
[_ the-ns] (re-find (re (<< "(.*)\\.~{simple-name}")) full-name)]
(when the-ns
(ns-resolve (find-ns (symbol the-ns)) (symbol (<< "map->~{simple-name}"))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment