This is documentation for the development version of Patricia Tree,
the latest released version is
v0.11.0.
Click here
to redirect to the latest version.
Patricia Tree API - WithForeign
Combination with other kinds of maps. Map2 must use the same KEY.to_int function.
Parameters
module Map2 : NODE_WITH_FIND with type _ key = keySignature
Like filter_map_no_share, but takes another map.
type ('value, 'map2) polyinter_foreign = {f : 'a. 'a Map2.key -> 'value value -> ('a, 'map2) Map2.value -> 'value value;
}val nonidempotent_inter :
('a, 'b) polyinter_foreign ->
'a t ->
'b Map2.t ->
'a tLike nonidempotent_inter, but takes another map as an argument.
type ('map1, 'map2) polyupdate_multiple = {f : 'a. key -> 'map1 value option -> ('a, 'map2) Map2.value -> 'map1 value option;
}val update_multiple_from_foreign :
'b Map2.t ->
('a, 'b) polyupdate_multiple ->
'a t ->
'a tThis 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) polyupdate_multiple_inter = {f : 'a. key -> 'map1 value -> ('a, 'map2) Map2.value -> 'map1 value option;
}val update_multiple_from_inter_with_foreign :
'b Map2.t ->
('a, 'b) 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.
type ('map1, 'map2) polydifference = ('map1, 'map2) polyupdate_multiple_interval difference : ('a, 'b) polydifference -> 'a t -> 'b Map2.t -> 'a tdifference 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 MAP_WITH_VALUE.difference, but allows the second map to be of a different type.