Re: best way to make use of association lists

2009-09-08 Thread B Smith-Mannschott
On Tue, Sep 8, 2009 at 15:22, Conrad wrote: > > Ah! ArrayMap! I missed that structure in the documentation! Well, I suspect there's a reason for that. > That was exactly what I'm looking for. Be aware that ArrayMap is something that Clojure uses internally only to represent very small maps. Bas

Re: best way to make use of association lists

2009-09-08 Thread Conrad
Thanks again everyone for the helpful replies- The clojure community is definitely one of the languages's strengths. On Sep 7, 5:19 pm, Conrad wrote: > Hi everyone! I have some data that consists of key/value pairs, but > that need to maintain their order, in terms of when they were added to > t

Re: best way to make use of association lists

2009-09-08 Thread Conrad
I agree that's a very sensible solution. On Sep 8, 1:20 am, rivercheng wrote: > Hi, > > How about just keep a list of keys as an extra list besides the hash- > map? > The look-up and iterating without order can be done efficiently > without the help of the key list. > Iterating with the original

Re: best way to make use of association lists

2009-09-08 Thread Conrad
Ah! ArrayMap! I missed that structure in the documentation! That was exactly what I'm looking for. On Sep 8, 1:09 am, Chouser wrote: > On Sep 7, 2009, at 5:19 PM, Conrad wrote: > > > > > Hi everyone! I have some data that consists of key/value pairs, but > > that need to maintain their order,

Re: best way to make use of association lists

2009-09-07 Thread Richard Newman
> Why not just use http://clojure.org/api#sorted-map ? Because an association list keeps insertion order, whilst a sorted-map keeps sorted order. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To

Re: best way to make use of association lists

2009-09-07 Thread kyle smith
Why not just use http://clojure.org/api#sorted-map ? --~--~-~--~~~---~--~~ 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 m

Re: best way to make use of association lists

2009-09-07 Thread rivercheng
Hi, How about just keep a list of keys as an extra list besides the hash- map? The look-up and iterating without order can be done efficiently without the help of the key list. Iterating with the original order is a little bit expensive but should be acceptable if the hash function is fast. Cert

Re: best way to make use of association lists

2009-09-07 Thread Chouser
On Sep 7, 2009, at 5:19 PM, Conrad wrote: > > Hi everyone! I have some data that consists of key/value pairs, but > that need to maintain their order, in terms of when they were added to > the list. In most lisps you'd do this with an association list, with a > performance penalty of course if t

Re: best way to make use of association lists

2009-09-07 Thread John Harrop
On Mon, Sep 7, 2009 at 5:19 PM, Conrad wrote: > Alternatively, I suppose it would be possible to create a new type of > map that performs better than an alist but can return items in the > order they were added to the list, if desired Or use an existing type: the java.util.LinkedHashMap. The do