but the reader spits an illegal argument exception. Is there different syntax which the reader could parse? Or am I using the wrong kind of thing?
Wrong kind of thing. defstruct defines a struct-map, which is simply a map with some guaranteed keys. It doesn't make any assertions about the values of those keys.
You could (as you did) define a creator function for a map (doesn't have to be a struct-map) that checks the types of its arguments and errors otherwise, but -- as you observed -- generally Clojure is not designed to do this kind of static type checking. It's a dynamic language.
The "new new" work in Rich's non-mainline branches allows much more flexibility in avoiding the need to drop down to Java to achieve this kind of object definition, but that's not in 1.1.
You might be interested in this: http://www.assembla.com/wiki/show/clojure/Datatypes
-- 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