Re: Dynamically creating defrecord

2015-01-26 Thread JUAN ANTONIO Ruz
Hi Sven, I was trying to do the same with my library tangrammer/defrecord-wrapper and, just today, I found a couple of links that worked fine for that http://grokbase.com/t/gg/clojure/11cjvz1jda/defrecord-based-on-runtime-metadata http://stackove

Re: Dynamically creating defrecord

2015-01-19 Thread Sven Richter
Thank you all for your answers and insights. As it often turns out, I don't need them. Clara rules also exposes other ways to pass data into rules. Best Regards, Sven On Sunday, January 18, 2015 at 3:34:17 AM UTC+1, Sean Corfield wrote: > > On Jan 17, 2015, at 3:04 PM, Matching Socks > wrote:

Re: Dynamically creating defrecord

2015-01-17 Thread Sean Corfield
On Jan 17, 2015, at 3:04 PM, Matching Socks wrote: > And defstruct has not been deprecated in the API documentation. Technically true but when you see comments like these out there it’s reasonable to assume that structs should be avoided: "We intentionally omit ... struct-maps, which are deprec

Re: Dynamically creating defrecord

2015-01-17 Thread Lee Spector
> On Jan 17, 2015, at 6:04 PM, Matching Socks wrote: > > Did you find something really wrong with defstruct? Occasions when the basis > fields are not known to the programmer seem better met by defstruct than > defrecord. And defstruct has not been deprecated in the API documentation. > Th

Re: Dynamically creating defrecord

2015-01-17 Thread Christopher Small
The reason you can't just call `(mk-rec "A" "ns" [a b c])` is that your `mk-rec` is a function, and `a`, `b`, and `c` are undefined. To have them interpretted as symbols, you'd either have to explicitly use `['a 'b 'c]`, or write `mk-rec` as a macro (as Lee points towards). I was able to get a

Re: Dynamically creating defrecord

2015-01-17 Thread James Reeves
On 17 January 2015 at 17:27, Sven Richter wrote: > > I am trying to create record definitions dynamically during runtime. > To what end? The right answer depends very much on your end goal. - James -- You received this message because you are subscribed to the Google Groups "Clojure" group. To

Re: Dynamically creating defrecord

2015-01-17 Thread Matching Socks
Did you find something really wrong with defstruct? Occasions when the basis fields are not known to the programmer seem better met by defstruct than defrecord. And defstruct has *not* been deprecated in the API documentation. The comment "Note: Most uses of StructMaps would now be better se

Re: Dynamically creating defrecord

2015-01-17 Thread Lee Spector
> On Jan 17, 2015, at 12:27 PM, Sven Richter wrote: > > I am trying to create record definitions dynamically during runtime. What I > would like to do is something like this: > > (defn mk-rec [record-name namespace arg-list] > (eval '(do (ns namespace) >(defrecord record-name arg