Konrad Hinsen a écrit : > 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. >
If you haven't tried it yet, there's clojure.lang.PersistentQueue: user=> (def empty-queue clojure.lang.PersistentQueue/EMPTY) #'user/empty-queue user=> (conj empty-queue 1) (1) user=> (conj *1 2 3 4) (1 2 3 4) user=> (pop *1) (2 3 4) user=> (peek *2) Christophe -- Professional: http://cgrand.net/ (fr) On Clojure: http://clj-me.blogspot.com/ (en) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---