If you are happy with sorting the data already, then put the pairs into a
sorted set, and use `subseq` and `rsubseq` to query.
Depending on the size of the data (i.e. how many coordinate pairs you have) and
the specifics of your usage (i.e. mostly, how dynamic the dataset is), using a
specializ
This comes to mind:
(set! *warn-on-reflection* true)
But you probably already considered it...
On Sun, Oct 21, 2012 at 4:27 AM, Brian Craft wrote:
> I have a vector of maps representing intervals with (start, end) coords in
> one dimension, that are non-overlapping, and sorted. At the moment I'm
Answering my own question, my issues were 1) overlooking a couple seqs that
were thousands of times slower than vectors, and 2) using / instead of
quot. Just found this video:
http://www.infoq.com/presentations/Crunching-Numbers-Clojure
I'm finding that seqs are pretty much always too slow, but
I have a vector of maps representing intervals with (start, end) coords in
one dimension, that are non-overlapping, and sorted. At the moment I'm not
using a sorted data type, just a vector.
The bottleneck in my code is in searching for intervals that overlap a
region, like so:
(defn filter-pr