package orsetto
Install
Dune Dependency
Authors
Maintainers
Sources
sha512=9b654edb663ae697563f150824047052f3b1bf760398f24bce6350553f031f73c46b6337239a1acd871e61238597ea92046809e3358290ff14d6ba671b449085
doc/orsetto.cf/Cf_rbtree/Map/Create/index.html
Module Map.Create
A functor to create a Map
module.
Parameters
module K : Cf_relations.Order
Signature
val nil : 'a t
The empty map.
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
.
Use min m
to obtain the key-value pair with the ordinally minimum key in m
. Raises Not_found
if m
is empty.
Use max m
to obtain the key-value pair with the ordinally maximum key in m
. Raises Not_found
if m
is empty.
Use search k m
to find Some v
associated in the map m
with key k
. Returns None
if m
does not contain k
.
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
.
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.
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.
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.
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.
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.
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.
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
.
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
.
Use to_seq_incr m
to produce the list of key-value pairs in m
in order of increasing key ordinality.
Use to_seq_decr m
to produce the list of key-value pairs in m
in order of decreasing ordinality.
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.