package patricia-tree
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=18fcde5d35d65c9bb2f9ec4ff732ecdd8969ba6fc2cf51d29ecb3be66e2fe664
sha512=da038d5096deb4bf3c02efd694e962ecf9b2571d140fa1fef17cce474f628ec070b93a44fd742748b9d3ba0e51041f864623d83e9cb0c72214abb0fb4a043625
doc/patricia-tree/PatriciaTree/MakeCustomHeterogeneousMap/WithForeign/index.html
Module MakeCustomHeterogeneousMap.WithForeignSource
Operation with maps/set of different types. Map2 must use the same KEY.to_int function.
Parameters
module Map2 : NODE_WITH_FIND with type 'a key = 'a keySignature
type ('map1, 'map2) polyinter_foreign = {f : 'a. 'a key -> ('a, 'map1) value -> ('a, 'map2) Map2.value -> ('a, 'map1) value;
}Like BASE_MAP.idempotent_inter. Tries to preserve physical equality on the first argument when possible.
type ('map2, 'map1) polyfilter_map = {f : 'a. 'a key -> ('a, 'map2) Map2.value -> ('a, 'map1) value option;
}Like BASE_MAP.filter_map_no_share, but allows to transform a foreigh map into the current one.
type ('map1, 'map2) polyupdate_multiple = {f : 'a. 'a key -> ('a, 'map1) value option -> ('a, 'map2) Map2.value -> ('a, 'map1) value option;
}This is equivalent to multiple calls to update, but more efficient. update_multiple_from_foreign m_from f m_to is the same as calling update k {f=fun v_to -> f.f k v_to v_from} m_to on all bindings (k, v_from) of m_from, i.e. update_multiple_from_foreign m_from f m_to calls f.f on every key of m_from, says if the corresponding value also exists in m_to, and adds or remove the element in m_to depending on the value of f.f. f.f is called in the unsigned order of KEY.to_int. O(size(m_from) + size(m_to)) complexity.
type ('map1, 'map2, 'map3) polyupdate_multiple_inter = {f : 'a. 'a key -> ('a, 'map1) value -> ('a, 'map2) Map2.value -> ('a, 'map3) value option;
}val update_multiple_from_inter_with_foreign :
'b Map2.t ->
('a, 'b, 'a) polyupdate_multiple_inter ->
'a t ->
'a tupdate_multiple_from_inter_with_foreign m_from f m_to is the same as update_multiple_from_foreign, except that instead of updating for all keys in m_from, it only updates for keys that are both in m_from and m_to.
difference f map1 map2 returns the map containing the bindings of map1 that aren't in map2. For keys present in both maps but with different values, f.f is called. If it returns Some v, then binding k,v is kept, else k is dropped.
f.f is called in the unsigned order of KEY.to_int.
This is the same as BASE_MAP.difference but allows the second map to be of a different type.
type ('a, 'b) key_value_value = | KeyValueValue : 'k key * ('k, 'a) value * ('k, 'b) Map2.value -> ('a, 'b) key_value_value
Existential wrapper for a key with two values
min_binding_inter m1 m2 is the minimal binding of the intersection. I.E. the KeyValueValue(k,v1,v2) such that (k,v1) is in m1, (k,v2) is in m2, and k is minimal using the unsigned order on keys.
Returns None if and only if the intersection is empty.
It is rougthly equivalent to calling unsigned_min_binding on nonindempotent_inter f m1 m2, but can be faster.
max_binding_inter m1 m2 is the same as min_binding_inter, but returns the maximum key instead of the minimum.