I don't know which of these two options are best in general, but I wonder; are persistance and immutability valuable properties of queues? Safe and cheap snap-shotting might be a nice feature of a queue but I (generally) wouldn't want it at the cost of more expensive "put" and "take" operations.
Java already have concurrent, albeit mutable, queue implementations in the java.util.concurrent package. Since most operations you'd want to execute on a queue are writes, I can't help but think that a mutable datastructure is better suited, and that an attempt with immutable structures would most likely end up simulating mutability with some form of "copy-on-write + CAS" scheme anyway. Then again, safe snapshots might really be important, and that's where I'd use PersistentQueue as Christophe Grand mentioned. On Tue, Feb 3, 2009 at 2:35 PM, Konrad Hinsen <konrad.hin...@laposte.net> wrote: > > Is there any reason to prefer lists over vectors or vice versa for > implementing queues? It seems that for both lists and vectors, adding > and removing at one end (front for lists, end for vectors) is cheap, > whereas it is expensive at the other end. For queues you need to add > at one end and remove from the other, so one of the two operations is > necessarily expensive. But is there a difference between the two? > > Konrad. > > > > > -- Venlig hilsen / Kind regards, Christian Vest Hansen. --~--~---------~--~----~------------~-------~--~----~ 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 clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---