On Fri, Aug 29, 2008 at 3:41 PM, Graham Fawcett <[EMAIL PROTECTED]> wrote: > Appending to a list is kludgey in general. Clojure's PersistentLists > are singly-linked lists (like Lisp's cons cells), and appending onto > their tails is O(n) because the entire list must be traversed to find > the tail (and IIRC because the source list is Persistent, the entire > structure must be reconstructed. This isn't the case for prepending to > a list, though).
I meant to add that prepending to a list is O(1), and the resulting list can share the entire structure of the source list -- so "head" operations on lists are very efficient. Graham --~--~---------~--~----~------------~-------~--~----~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---