|
|
|
|
|
by bitsai
5086 days ago
|
|
As of Clojure 1.3, defrecord (and deftype) automatically define factory functions in the same namespace as the record itself. defrecord generates 2 such functions, one that takes positional arguments and one that takes a map. So once you have :use'd or :require'd the namespace, you can do stuff like the following without having to import anymore: (->World [:foo])
(->World {:tiles [:foo]})
More details here:http://dev.clojure.org/display/design/defrecord+improvements |
|
It's good to know that progress toward patching all the places Java tends to leak through into Clojure is happening.
I can't say I'm a fan of the punctuation-laden syntax, but I'll pick my battles and not complain about it.
I'll switch over to this new form tonight and mention it in one of the later posts. Thanks!