Clojure already has a built in queue.  The empty queue is:
clojure.lang.PersistentQueue/EMPTY
and then you can use all the usual conj/into/pop/peek functions on it.
For some reason, PersistentQueue is not documented, so new users have
no reason to know about it until they happen to ask about it here.

You might be interested to compare your priority queue implementation
to my "priority map" in 1.3 alpha's contrib, which also supports
updating items' priorities.

As far as I can tell, your priority queue's pop is not O(1), because
the underlying sorted map doesn't support "first" in O(1).  It's
actually O(log32#of priorities).  My priority map is similar, and I
agree that this behavior is quite fast, but it's worth noting that
it's not truly O(1).

-- 
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