https://github.com/clojure/data.priority-map

clojure.data.priority-map is a map-like data structure that sorts by
value.  It is useful in many situations where you might ordinarily use a
priority queue.

NEW for version 0.0.8 is support for subseq and rsubseq.

I had always intended to support subseq and rsubseq for priority-map.
Clojure theoretically supports extending subseq and rsubseq to new
collections by implementing the methods of clojure.lang.Sorted.  However,
when I first tried to do this, I discovered that there were some
assumptions baked into the clojure.core implementations of subseq and
rsubseq that made it impossible to extend support to priority-map.
Specifically, the clojure.core implementations of subseq and rsubseq assume
that there will never be more than one item tied for a given priority.  But
supporting tied priorities is a key value proposition of priority-map!

So, in 2010, I filed a JIRA issue and created a patch so that subseq and
rsubseq would work with priority-maps and other novel sorted data
structures.
https://dev.clojure.org/jira/browse/CLJ-428

Eight years later, I've decided not to wait any longer for this patch to be
incorporated into core.

As a workaround, the clojure.data.priority-map namespace now contains its
own patched version of subseq and rsubseq.  These can be used as a drop-in
replacement for the implementations found in core, so if you use the subseq
and rsubseq found in clojure.data.priority-map, they will work on
priority-maps as well as Clojure's other sorted collections.

I hope you enjoy the new functionality and find it useful!

--Mark Engelberg

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to