Re: defstruct defrecord metadata

2012-07-02 Thread JDuPreez
Hi, I only needed the 'annotations' to work with structmaps and records (data structures I use to define my domain model), therefore ignored other data structures: (defn cut-key [it] (if (keyword? it) it (keyword (str it (def decorations (atom {})) ; Argument "decor" should be

Re: defstruct defrecord metadata

2012-05-17 Thread Frank Siebenlist
Is this thread related to http://dev.clojure.org/jira/browse/CLJ-304 ? Would be nice to address that issue. -FrankS. On May 16, 2012, at 6:54 AM, Tim Visher wrote: > On Tue, May 15, 2012 at 12:11 PM, JDuPreez wrote: >> Maybe I should post my solution to this problem here? > > Sounds like a p

Re: defstruct defrecord metadata

2012-05-16 Thread Tim Visher
On Tue, May 15, 2012 at 12:11 PM, JDuPreez wrote: > Maybe I should post my solution to this problem here? Sounds like a plan. :) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that

Re: defstruct defrecord metadata

2012-05-15 Thread JDuPreez
Stefan, Thank you for your reply. You are referring to applying an annotation to an instance/object. If we could imagine it existed for the moment, this is what I'd be looking for: (meta {:foo "meta"} (defrecord Foo (bar baz))) I should then somehow be able to retrieve the metadata of the type

Re: defstruct defrecord metadata

2012-05-15 Thread Stefan Kamphausen
Hi, I am not sure whether I fully understand your question. However, when you create a record, a second constructor will be created for you which also expects a meta-data map: user=> (defrecord Foo (bar baz)) user=> (meta (Foo. 2 3 {:foo "meta"} nil)) {:foo "meta"} Hope that helps. Stefan -

Re: defstruct defrecord metadata

2012-05-15 Thread Tim Visher
On Sat, May 12, 2012 at 3:48 PM, JDuPreez wrote: > I'm new to Clojure. I've been unsuccessful in finding a clear answer or > getting it to work (might just have done it incorrectly, since I'm still > learning). I understand that you can add metadata to an object, "with-meta", > and to a variable o

defstruct defrecord metadata

2012-05-14 Thread JDuPreez
Hi, I'm new to Clojure. I've been unsuccessful in finding a clear answer or getting it to work (might just have done it incorrectly, since I'm still learning). I understand that you can add metadata to an object, "with-meta", and to a variable or parameter, "^{:". However, I would like to appl