Module Core_map_intf

module Core_map_intf: sig .. end
This module defines interfaces used in Core.Std.Map. See the documentation in core_map.mli for a description of the approach.

val __pa_ounit_275876e34cf609db118f3d84b799a790 : string

This module defines interfaces used in Core.Std.Map. See the documentation in core_map.mli for a description of the approach.
module Binable: Binable0
module List: List
module type Key = Comparator.Pre
module type Key_binable = Comparator.Pre_binable
type ('key, 'comparator, 'z) without_comparator = 'z 
type ('key, 'comparator, 'z) with_comparator = comparator:('key, 'comparator) Comparator.t -> 'z 
module type Accessors = sig .. end
module type Creators = sig .. end
module type Creators_and_accessors = sig .. end
module type S = sig .. end
module type S_binable = sig .. end

This module defines interfaces used in Core.Std.Map. See the documentation in core_map.mli for a description of the approach.

Test if invariants of internal AVL search tree hold.

Test whether a map is empty or not.

length map

returns a new map with the specified new binding; if the key was already bound, its previous binding disappears.

if key is not present then add a singleton list, otherwise, cons data on the head of the existing list.

change map key f updates the given map by changing the value stored under key according to f. Thus, for example, one might write:

change m k (function None -> Some 0 | Some x -> Some (x + 1))

to produce a new map where the integer stored under key k is incremented by one (treating an unknown key as zero)

returns the value bound to the given key, raising Not_found if none such exists

returns a new map with any binding for the key in question removed

mem map key tests whether map contains a binding for key

iterator for map

Iterate two maps side by side. Complexity of this function is O(M+N). If two inputs are (0, a); (1, a) and (1, b); (2, b), f will be called with (0, `Left a); (1, `Both (a, b)); (2, `Right b)

returns new map with bound values replaced by f applied to the bound values

like map, but function takes both key and data as arguments

folds over keys and data in map in increasing order of key.

folds over keys and data in map in decreasing order of key.

returns new map with bound values filtered by f applied to the bound values

like filter_map, but function takes both key and data as arguments

Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

returns list of keys in map

returns list of data in map

creates association list from map. No guarantee about order.

Additional operations on maps


merges two maps

symmetric_diff t1 t2 ~data_equal returns a list of changes between t1 and t2. It is intended to be efficient in the case where t1 and t2 share a large amount of structure.

min_elt map

max_elt map

same semantics as similar functions in List

fold_range_inclusive t ~min ~max ~init ~f folds f (with initial value ~init) over all keys (and their associated values) that are in the range min, max (inclusive).

range_to_alist t ~min ~max returns an associative list of the elements whose keys lie in min, max (inclusive), with the smallest key being at the head of the list.

prev_key t k returns the largest (key, value) pair in t with key less than k

next_key t k returns the smallest (key, value) pair in t with key greater than k

rank t k if k is in t, returns the number of keys strictly less than k in t, otherwise None

the empty map

map with one key, data pair

creates map from sorted array of key-data pairs. The input array must be sorted, as given by the relevant comparator (either in ascending or descending order), and must not contain any duplicate keys. If either of these conditions do not hold, an error is returned.

Like of_sorted_array except behavior is undefined when an Error would have been returned.

creates map from association list with unique keys

creates map from association list with unique keys. Raises an exception if duplicate 'a keys are found.

creates map from association list with possibly repeated keys.

combines an association list into a map, folding together bound values with common keys