package codex

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Interval_mapSource

A rangemap partitions an interval in 0..size into sub-intervals, and associates a value to this interval (or, more precisely, to each element of this interval).

Sourcetype 'a t
Sourcetype key = int
Sourceval create : size:int -> 'a -> 'a t

Create a new interval map with a given size.

Sourceval iter_between : size:int -> key -> 'a t -> (size:int -> key -> 'a -> unit) -> unit

Iterate on every interval in [key,key+size-1] in a map.

Sourceval fold_between : size:int -> key -> 'a t -> 'b -> (size:int -> key -> 'a -> 'b -> 'b) -> 'b

Fold on every interval in [key,key+size-1] in a map.

Sourceval store : size:int -> key -> 'a t -> 'a -> 'a t

Adds a mapping to the interval [key,key+size-1] in the map.

Sourceval get_size : 'a t -> int

Total size of the interval map.

Sourceval fold_on_diff : 'a t -> 'a t -> 'b -> (size:int -> key -> 'a -> 'a -> 'b -> 'b) -> 'b

Calls f ~size key va vb acc when the value for the interval [key,key+size-1] is different in both maps (and is respectively va and vb). The different intervals are called in increasing order.

Sourceval fold_on_diff3 : 'a t -> 'a t -> 'a t -> 'b -> (size:int -> key -> 'a -> 'a -> 'a -> 'b -> 'b) -> 'b

Like fold_on_diff, but with three maps. Less optimized too.

Sourceval subst_between : key -> size:int -> 'a t -> (size:int -> key -> 'a -> 'a) -> 'a t

Replace the value of every interval in [key,key+size-1]. Preserve physical equality when feasible.

Sourcemodule With_Extract (Value : sig ... end) : sig ... end

This associates value to an interval, but splitting (or concatenating) interval affects the value they contain.