Ah! ArrayMap! I missed that structure in the documentation!

That was exactly what I'm looking for.

On Sep 8, 1:09 am, Chouser <chou...@gmail.com> wrote:
> On Sep 7, 2009, at 5:19 PM, Conrad <drc...@gmail.com> 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 the alist gets too large.
>
> I've used array-map in a couple cases like this.  You can build it  
> with (apply array-map my-key-val-seq) and it will keep the order you  
> give it.  If you use assoc you're likly to get back a randomly-ordered  
> hash map, but sometimes you just don't need to do that.  This has the  
> same O(n) perf as alists.
>
> Another option to keep in mind is a struct map, which will give you  
> faster lookups and keep the order of the set of keys in the initial  
> definition.
>
> Between the two you may be able to get what you need for a lot of cases.
>
> --Chouser
--~--~---------~--~----~------------~-------~--~----~
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