package orsetto

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

The module type of functional maps.

type index

The index type.

type +'a t

The map type.

val nil : 'a t

The empty map.

val one : (index * 'a) -> 'a t

Use one (k, v) to create a map with one key k for value v.

val empty : 'a t -> bool

Use empty m to test whether m is the empty map.

val size : 'a t -> int

Use size m to count the number of keys in m.

val min : 'a t -> index * 'a

Use min m to obtain the key-value pair with the ordinally minimum key in m. Raises Not_found if m is empty.

val max : 'a t -> index * 'a

Use max m to obtain the key-value pair with the ordinally maximum key in m. Raises Not_found if m is empty.

val member : index -> 'a t -> bool

Use member k m to test whether m contains k.

Use search k m to find Some v associated in the map m with key k. Returns None if m does not contain k.

val require : index -> 'a t -> 'a

Use require k m to find the value assocoated in the map m with the key k. Raises Not_found if m does not contain k.

val insert : (index * 'a) -> 'a t -> 'a t * 'a option

Use insert p m to insert the key-value pair p into m, producing a new map with the inserted element and, if k is already present in m, the value replaced by the insertion.

val replace : (index * 'a) -> 'a t -> 'a t

Use replace p m to obtain a new map produced by inserting the key-value pair p into the map m, replacing any existing pair associated to the same key.

val modify : index -> ('a -> 'a) -> 'a t -> 'a t

Use modify k f m to obtain a new tree produced by replacing the value in m associated with k with the result of applying it to the continuation function f. Raises Not_found if m does not contain the key.

val extract : index -> 'a t -> 'a * 'a t

Use extract k m to obtain the value associated with the key k in m and a new map with the key deleted from the map. Raises Not_found if the map does not contain the key.

val delete : index -> 'a t -> 'a t

Use delete k m to obtain a new map produced by deleting the key k from m. If m does not contain the key, then the function simply returns its argument.

val of_seq : (index * 'a) Seq.t -> 'a t

Use of_seq s to consume a sequence s and compose a new map by inserting each key-value pair produced in the order produced.

val of_seq_incr : (index * 'a) Seq.t -> 'a t

Use of_seq_incr s to compose the map with key-value pairs in the sequence s. Runs in linear time if the sequence s is known to be in increasing order. Otherwise, there is an additional linear cost beyond of_seq s.

val of_seq_decr : (index * 'a) Seq.t -> 'a t

Use of_seq_decr s to compose the map with key-value pairs in the sequence s. Runs in linear time if the sequence s is known to be in decreasing order. Otherwise, there is an additional linear cost beyond of_seq s.

val to_seq_incr : 'a t -> (index * 'a) Seq.t

Use to_seq_incr m to produce the list of key-value pairs in m in order of increasing key ordinality.

val to_seq_decr : 'a t -> (index * 'a) Seq.t

Use to_seq_decr m to produce the list of key-value pairs in m in order of decreasing ordinality.

val to_seq_nearest_decr : index -> 'a t -> (index * 'a) Seq.t

Use to_seq_nearest_decr k m to obtain the key-value pair ordinally less than or equal to k in m. Raises Not_found if m is empty or all the keys are ordinally greater.

val to_seq_nearest_incr : index -> 'a t -> (index * 'a) Seq.t

Use to_seq_nearest_incr k m to obtain the key-value pair ordinally greater than or equal to k in m. Raises Not_found if m is empty or all the keys are ordinally greater.