Skip to content

Inverse mappings/ interval intersections? #11

@yuhan0

Description

@yuhan0

Thanks for releasing this library :)

Given an interval map

(def x (dean/interval-map
         {[1 3] :x1
          [4 7] :x2}))

Is there any way of querying it for the inverse mapping - ie. what interval does :x1 correspond to?

My use case is finding the intersection between an interval-map and some other interval, ie. something like

(intersect-interval x [5 9]) 
;; => {:x2 [4 7]}

Is this possible to do with the data structure, or will I have to maintain a parallel inverse mapping?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions