package interval-map

  1. Overview
  2. Docs

Module Interval_map.MakeSource

Parameters

Signature

Sourcemodule Bound : sig ... end
Sourcemodule Interval : sig ... end
Sourcemodule Gen : sig ... end
Sourcetype 'a t
Sourceval empty : 'a t

empty is an empty interval map.

Sourceval size : 'a t -> int

size map returns the number of values stored in the map. Multiple values may be stored with each interval, so the number of values is not necessarily the same as the number of intervals.

Sourceval cardinal : 'a t -> int

cardinal map is the same as size map

Sourceval add : Interval.t -> 'a -> 'a t -> 'a t

add interval value map adds value to map associated with interval. Not tail recursive.

Sourceval remove_by : Interval.t -> ('a -> bool) -> 'a t -> 'a t

remove_by interval value_rm_fn map removes all values associated with interval for which value_rm_fn returns true in map. Not tail recursive.

Sourceval remove_interval : Interval.t -> 'a t -> 'a t

remove_interval interval map removes the interval and all associated values from map. Not tail recursive.

Sourceval generator : ?order:order -> 'a t -> 'a Gen.t

generator order map creates a generator that traverses map. See Gen for generator API.

Sourceval fold : (Interval.t -> 'a list -> 'b -> 'b) -> 'a t -> 'b -> 'b

fold fn map acc folds over map applying function fn in ascending order of the intervals. fn takes the interval, values, and the accumulator as parameters and returns the updated accumulator. Tail recursive.

Sourceval mapi : (Interval.t -> 'a list -> 'b list) -> 'a t -> 'b t

mapi fn map builds a new interval map by applying fn to the elements in map. Elements are not traversed in order. Tail recursive.

Sourceval map : ('a list -> 'b list) -> 'a t -> 'b t

map fn map is like mapi but fn does not receive the interval. Tail recursive.

Sourceval iteri : (Interval.t -> 'a list -> unit) -> 'a t -> unit

iteri fn map applies fn to every element of the map in ascending order of the intervals. fn received both the interval and associated values and returns unit. Tail recursive.

Sourceval iter : ('a list -> unit) -> 'a t -> unit

iter fn map is like iteri but fn does not receive the interval. Tail recursive.

Sourceval to_list : 'a t -> (Interval.t * 'a list) list

to_list map converts map into a list where the elements of the resulting list are in ascending order by interval. Tail recursive.

Sourceval to_seq : 'a t -> (Interval.t * 'a list) Seq.t

to_seq map converts map into a Seq.t where the elements of the resulting seq are in ascending order by interval. Seqs are lazy so elements of the map are not traversed until the resulting seq is traversed.

Sourceval find_opt : Interval.t -> 'a t -> 'a list option

find_opt interval map finds all values associated with interval in map, or None if map does not contain interval. Tail recursive.

Sourceval find : Interval.t -> 'a t -> 'a list

find interval map finds all values associated with interval in map, or raises Not_found if map does not contain interval. Tail recursive.

Sourceval mem : Interval.t -> 'a t -> bool

mem interval map returns true if map contains interval, and false otherwise. Tail recursive.

Sourceval query_interval : ?order:order -> Interval.t -> 'a t -> 'a Gen.t

query_interval interval map finds all values associated with interval in the map. Results are provided as a generator, which traverses the map as results are read.

Sourceval query_interval_list : Interval.t -> 'a t -> (Interval.t * 'a list) list

query_interval interval map finds all values associated with interval in the map and returns the results as a list. Tail recursive.

OCaml

Innovation. Community. Security.