package interval-map

Build not checked
  1. Overview
  2. Docs
An immutable interval map data structure

Install

dune-project
 Dependency

Authors

Maintainers

Sources

interval-map-0.2.0.tbz
sha256=e7fb0d1aa8dc5d680066069e4dc8d2f7c4204b7d3398649c74c32690fc13ee91
sha512=ff6091efdef6f4c4c8e0fd93428f8646b99beefc1b47c5de74153be5d4b9264bb11e64388c794deb6dd1017ff7d383e82d0b6590799e901fe6b42aa015dd5a3f

Description

An immutable interval map data structure implemented as an interval tree. Based on jgblight/im_interval_tree.

Interval maps are great for finding intervals and their associated values which overlap a given interval. This interval map supports intervals with excluded, included, and unbounded bound ends. Multiple values may be associated with the same interval.

Added to opam-repository:

README

interval-map

Actions Status

Documentation

An immutable interval map data structure implemented as an interval tree. Based on jgblight/im_interval_tree.

Interval maps are great for finding intervals and their associated values which overlap a given interval. This interval map supports intervals with excluded, included, and unbounded bound ends. Multiple values may be associated with the same interval.

Installation

opam install interval-map

Usage

let module Ivl_map = Interval_map.Make (Int) in
let module Ivl = Ivl_map.Interval in
(* Build the map *)
let map =
  Ivl_map.empty
  |> Ivl_map.add (Ivl.create (Included 0) (Excluded 10)) "foo"
  |> Ivl_map.add (Ivl.create (Included 0) (Excluded 10)) "foo2"
  |> Ivl_map.add (Ivl.create (Excluded 0) (Included 10)) "bar"
  |> Ivl_map.add (Ivl.create (Included 5) (Included 10)) "baz"
  |> Ivl_map.add (Ivl.create (Excluded 4) (Excluded 10)) "oof"
  |> Ivl_map.add (Ivl.create Unbounded (Excluded 4)) "zab"
in

(* Query the map *)
let query = Ivl.create Unbounded (Included 4) in
Ivl_map.query_interval query map
|> Ivl_map.Query_results.to_list
(* Results:
  [({Ivl_map.Interval.low = Ivl_map.Bound.Unbounded; high = Ivl_map.Bound.Excluded 4},
    ["zab"]);
    ({Ivl_map.Interval.low = Ivl_map.Bound.Included 0; high = Ivl_map.Bound.Excluded 10},
    ["foo2", "foo"]);
    ({Ivl_map.Interval.low = Ivl_map.Bound.Excluded 0; high = Ivl_map.Bound.Included 10},
    ["bar"])]
  *)

Dependencies (2)

  1. dune >= "2.0"
  2. ocaml >= "4.08.0"

Dev Dependencies (2)

  1. odoc with-doc
  2. alcotest with-test

Optional Dependencies

None

Used by

None

Conflicts

None

Build status

Results of building interval-map with each compiler on check.ci.ocaml.org, run of against opam-repository 78c202b. All results for this package.

Each result links to its build log. To keep crawlers from overloading the site, build logs require a GitHub sign-in (see ocurrent/opam-health-check). On your first log, GitHub asks you to “Authorize opam-health-check”, the OCurrent app that runs these checks; it sees only your public profile, not your repositories. The sign-in lasts 30 days.

This version is not in the latest run; the versions below are.

Version OCaml 4.11 OCaml 4.14 OCaml 5.2 OCaml 5.4 OCaml 5.5
0.2.1 good good good good good
  • good Package successfully built
  • partial One of the dependencies failed to build
  • bad Package failed to build
  • n/a Package is not available in this environment
  • internal Internal failure