On Thu, Aug 27, 2009 at 9:35 PM, Howard Lewis Ship <hls...@gmail.com> wrote:

> Literally: when iterating over the key/value pairs, the order seems to
> be the order in which the key/values are defined in the map. Is this
> true?


user=> {"0" 0 "1" 1 "2" 2 "3" 3 "4" 4 "5" 5 "6" 6 "7" 7 "8" 8 "9" 9 "10" 10
"11" 11 "12" 12 "13" 13 "14" 14 "15" 15}
{"11" 11, "12" 12, "13" 13, "14" 14, "15" 15, "0" 0, "1" 1, "2" 2, "3" 3,
"4" 4, "5" 5, "6" 6, "7" 7, "8" 8, "9" 9, "10" 10}

nor the insertion order:
user=> (into {} (for [i (range 16)] [(str i) i]))
{"11" 11, "12" 12, "13" 13, "14" 14, "15" 15, "0" 0, "1" 1, "2" 2, "3" 3,
"4" 4, "5" 5, "6" 6, "7" 7, "8" 8, "9" 9, "10" 10}

but the order should be stable for a given set of keys.

BUT if your map is small enough it may be an arraymap: definition/insertion
order will be preserved.


-- 
Professional: http://cgrand.net/ (fr)
On Clojure: http://clj-me.blogspot.com/ (en)

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to