Hey everyone,
I'm busy implementing a macro whose usage looks like this:
(defentity Person
{:name {:type String :validator name-validator}
:id-number {:type String :validator id-number-validator}
:height{:type Float :default 0.0}
:weight{:type Float :default 0.0}
Keys from literal maps aren't sorted; you need a sorted map.
user= (keys {:z 1 :f 2 :a 0})
(:z :a :f)
user= (keys (sorted-map :z 1 :f 2 :a 0))
(:a :f :z)
On May 3, 4:08 am, David Jagoe davidja...@gmail.com wrote:
Hey everyone,
I'm busy implementing a macro whose usage looks like this:
On May 3, 2011, at 7:08 AM, David Jagoe wrote:
Can I rely on (keys some-literal-map) always returning the keys in the
order they were defined in the literal map?
In general, the key order is not guaranteed, but an array-map will maintain the
insertion order of the keys. Use the array-map
Thanks for the responses.
On 3 May 2011 17:39, Steve Miner stevemi...@gmail.com wrote:
On May 3, 2011, at 7:08 AM, David Jagoe wrote:
For your specific purpose, I would be careful about using a map as an
entity specification. If the order is significant, a vector of field
specifiers would