Re: Function to Generate EDN :readers Map for Namespace Records?

2013-12-07 Thread Michael Daines
Thanks, that inspired me to look around. I didn't figure out how to hijack the defrecord macro, but I was able to write something based upon the code there: (def reader-map (let [records (filter #(re-find #"^map-" (str (key %))) (ns-publics *ns*)) splat (fn [pai

Function to Generate EDN :readers Map for Namespace Records?

2013-12-06 Thread danle...@gmail.com
Instead of trying to do it that way, how about just a thin layer of macrology around defrecord? Within the def-record-reader firm you have access to all the info you need for each reader, without extensive code-walking etc -- -- You received this message because you are subscribed to the Goog

Re: Function to Generate EDN :readers Map for Namespace Records?

2013-12-06 Thread Steve Miner
I use a default reader to do something like what you're asking for in my 'tagged' library. You could hack a similar default reader that restricted itself just to your favorite namespaces. That way you don't have to explicitly track all your defrecord classes. https://github.com/miner/tagged

Function to Generate EDN :readers Map for Namespace Records?

2013-12-05 Thread Michael Daines
I'm trying to come up with a function that will take a namespace containing Record definitions and convert it into a :readers map for EDN parsing. Right now, I'm just doing it manually, but as the number of records grows, this feels sillier and sillier. I haven't found anything in the core libr