> Maybe it's premature optimization, but I don't want the overhead of a
> sorted map structure when a minimal (and ideally, optimized for few
> keys) map will do better.
Then you might want to look at struct-map... predefined keys are in a
fixed order.
--~--~-~--~~~
Maybe it's premature optimization, but I don't want the overhead of a
sorted map structure when a minimal (and ideally, optimized for few
keys) map will do better.
On Tue, Sep 1, 2009 at 11:46 AM, Rob Lachlan wrote:
>
> As, Patrick Sullivan, said, the built-in sorted-map guarantees that
> the key
As, Patrick Sullivan, said, the built-in sorted-map guarantees that
the keys will be in order. I'm probably missing something here, but
wouldn't that fit the bill?
http://clojure.org/api#sorted-map
Rob Lachlan
On Aug 27, 12:35 pm, Howard Lewis Ship wrote:
> Is the order of keys in a map predi
On Sat, Aug 29, 2009 at 3:19 AM, Travis wrote:
> Is the number 8 just a magic number? Can it be changed with an
> environment variable or system variable or binding? I would definitely
> like to.
You can't change it.
Clojure's ArrayMap is really designed for a small number of kv pairs (eg no
st
Is the number 8 just a magic number? Can it be changed with an
environment variable or system variable or binding? I would definitely
like to.
I am particularly annoyed by how the function into changes my array
maps into hash maps when they grow. The type of the first argument is
an array map, so
Howard,
I ran into the exact same problem. Check out the discussion on fn-
tuple here:
http://groups.google.com/group/clojure-dev/browse_thread/thread/155c8b9893d673bc#
This should do what you need.
Sean
On Aug 27, 3:35 pm, Howard Lewis Ship wrote:
> Is the order of keys in a map predictabl
On Thu, Aug 27, 2009 at 9:35 PM, Howard Lewis Ship 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 "
Traditionally, there is no guarantee for the sorting order of keys in a map.
There are sorted map implementations around though if you are in need of
this functionality (I'm not sure if there is a Clojure sorted map, but the
algorithm is out there).
On Thu, Aug 27, 2009 at 12:35 PM, Howard Lewis
> 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?
For small numbers of keys (<7 I think) they're stored in a linear
format (analogous to an associative list), and the insertion order is
effec
On Thu, Aug 27, 2009 at 3:35 PM, Howard Lewis Ship wrote:
>
> Is the order of keys in a map predictable? I have some tests I'm
> concerned about, where the keys and values in a map are converted to a
> string (ultimately, a URL, as query parameters) and the order will
> affect the output string.
> Key order is preserved for array-maps. Map literals up to 8 pairs
> are array-maps. Beginning with 9 pairs you get a hash-map. I'm not
> aware of a rule how to determine the order of keys of a hash-map.
> This is implementation specific, I would assume. (Thus can change at
> any arbitrar
Hi,
Am 27.08.2009 um 21:35 schrieb Howard Lewis Ship:
Is the order of keys in a map predictable? I have some tests I'm
concerned about, where the keys and values in a map are converted to a
string (ultimately, a URL, as query parameters) and the order will
affect the output string.
I could so
If you look at the data_structures page on clojure.org you'll see
there are sorted maps available to allow guarantees of being sorted by
Key.
~Patrick
On Aug 27, 1:40 pm, Jeremy Gailor wrote:
> Traditionally, there is no guarantee for the sorting order of keys in a map.
>
> There are sorted map
Is the order of keys in a map predictable? I have some tests I'm
concerned about, where the keys and values in a map are converted to a
string (ultimately, a URL, as query parameters) and the order will
affect the output string.
I could sort the keys, but then I'm changing my code to support the
14 matches
Mail list logo