I could represent the map {0 :foo, 1000000 :bar} as an array, but it would have to be a million element array with a lot of empty space. This would be (maybe) faster w.r.t. lookups, but would be vastly slower for enumerating entries, merging other maps, and adding keys that are larger than the boundaries of the underlying array. This data structure, which is described by the paper linked in the readme, I also mention the possibility of using this to represent a sparse vector (as opposed to the array, which is dense) in the readme.
Hope that answers your question, Zach On Sunday, April 20, 2014 9:44:21 PM UTC-7, Plinio Balduino wrote: > > "it's an immutable map that can only have positive integers as keys" -- Like > an array? > > (My question is child of my complete ignorance, and I'm not questioning > your knowledge or motivation) > > Plínio > > > On Mon, Apr 21, 2014 at 1:40 AM, Zach Tellman <ztel...@gmail.com<javascript:> > > wrote: > >> This one's pretty simple: it's an immutable map that can only have >> positive integers as keys. It can be found at >> https://github.com/ztellman/immutable-int-map. >> >> The one interesting aspect of this is that it has an efficient merge >> mechanism, which means it plays better with Clojure's reducer framework >> than Clojure's own data structures. This was a non-obvious consequence to >> me before I started working on it, so I figure others might also find it >> interesting. >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Clojure" group. >> To post to this group, send email to clo...@googlegroups.com<javascript:> >> Note that posts from new members are moderated - please be patient with >> your first post. >> To unsubscribe from this group, send email to >> clojure+u...@googlegroups.com <javascript:> >> For more options, visit this group at >> http://groups.google.com/group/clojure?hl=en >> --- >> You received this message because you are subscribed to the Google Groups >> "Clojure" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to clojure+u...@googlegroups.com <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > > -- 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.