Hi,
use the factory function.
Clojure 1.3.0
user=> (defrecord car [year manufacturer])
user.car
user=> (defn create [stuff] (stuff 1982 "Mercedes Benz"))
#'user/create
user=> (create ->car)
#user.car{:year 1982, :manufacturer "Mercedes Benz"}
You can't pass car. around at runtime because it is a class. And instantiating
a class is hard-wired in the byte code. Hence the actual class must be known at
compile time. ->car however is a normal clojure function. So you can pass it
around as you like.
Sincerely
Meikel
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en