is it ->record just a shortrand for record.? 2011/10/6 Aaron Bedra <aaron.be...@gmail.com>
> Assuming you want to do things with the record later, why not just > create it in the let binding > > (let [foo (->car 1982 "Mercedes")] > ...) > > or > > (let [foo (car. 1982 "Mercedes")] > ...) > > or even > > (let [foo (map->car {:year 1982 :manufacturer "Mercedes"})] > ...) > > or if you must > > (let [foo #user.car{:year 1982 :manufacturer "Mercedes"}] > ...) > > Cheers, > > Aaron Bedra > -- > Clojure/core > http://clojure.com > > On 10/06/2011 01:27 PM, Razvan Rotaru wrote: > > Hi, > > > > I want to instantiate a record, but having the record type as value at > > runtime. > > > > Example: > > (defrecord car [year manufacturere]) > > (defrecord bike [year manufacturere]) > > (defrecord boat [year manufacturer]) > > > > I want to do (new stuff 1982 "Mercedes"), but having the record type > > kept in the variable "stuff". Something like: > > > > (let [stuff car] > > (new stuff 1982 "Mercedes")) > > > > (let [stuff bike] > > (new stuff 1990 "Harley Davidson")) > > > > Obviously new does not work. I'm gratefull for suggestions of how to > > do it best. > > > > Thanks, > > Razvan > > > > -- > 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 posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > -- 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 posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en