package orsetto

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

A functor to create a Map module.

Parameters

Signature

type +'a t

The map type.

val nil : 'a t

The empty map.

val one : (K.t * '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 -> K.t * '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 -> K.t * '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 : K.t -> '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 : K.t -> '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 : (K.t * '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 : (K.t * '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 : K.t -> ('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 : K.t -> '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 : K.t -> '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 : (K.t * '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 : (K.t * '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 : (K.t * '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 -> (K.t * '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 -> (K.t * '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 : K.t -> 'a t -> (K.t * '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 : K.t -> 'a t -> (K.t * '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.

OCaml

Innovation. Community. Security.