Re: defrecord constructor woes

2011-01-25 Thread Mike
thanks!!! On Jan 25, 8:55 am, Meikel Brandmeyer wrote: > Hi, > > constructors (like methods) are not first class. You have to wrap it > in a factory function. > > (defn make-foo >   [a b c d] >   (Foo. a b c d)) > > (apply make-foo [1 2 3 4]) > > Sincerely > Meikel -- You received this message

Re: defrecord constructor woes

2011-01-25 Thread Meikel Brandmeyer
Hi, constructors (like methods) are not first class. You have to wrap it in a factory function. (defn make-foo [a b c d] (Foo. a b c d)) (apply make-foo [1 2 3 4]) Sincerely Meikel -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to thi

defrecord constructor woes

2011-01-25 Thread Mike
Quick question...I am trying to populate a record with values provided in a list. I'm definitely doing it the wrong way...but maybe there's no good way to do it. Here's what I do (clojure 1.2.0 by the way): (defrecord Foo [x y z]) (Foo. 1 2 3) #:user.Foo{:x 1, :y 2, :z 3} but then: (apply Foo