Hi folks, I've been experimenting with the new type system in Clojure 1.2, but I've hit something of a problem. If I define a record:
user=> (defrecord Foo []) user.Foo Then I can coerce a map into a type Foo like so: user=> (def m {:x 1, :y 2}) #'/user/m user=> (Foo. {} m) #:user.Foo{:x 1, :y 2} But what if I define an argument in the record constructor? user=> (defrecord Bar [x]) user.Bar I can't use (Bar. {} m); I'd have to use (Bar. (m :x) {} (dissoc m :x)), but this depends on me knowing in advance that x is an argument in Bar's constructor. So is there a programmatic way of telling what keys a record derives from its constructor? Or if there is any other way of coercing a map into an arbitrary record? - James -- 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