crdt/lattice
src/crdt/lattice.tur
defn
map-merge-with
(map-merge-with [a : int b : int ^fat f : (fn [int int])
merge two maps, COMBINING values under a shared key.
Parameters
| a | first map | |
| b | second map | |
| f | (fn [int int] int) applied to (a[k], b[k]) when both have k |
Returns
A new map holding every key of both, with f applied where they overlap.
Example
(map-merge-with a b (fn [x : int y : int] : int (if (< x y) y x)))
Since: crdt-spice-plan C1
defn
join-all
(join-all [^JoinSemilattice A ^BoundedJoin A])
join every element of a Vec, from bottom.
Parameters
| v | Vec of lattice values |
Returns
bottom when v is empty, else every element joined together.
Example
(join-all (vec-of (:: 1 MaxI) (:: 7 MaxI))) ; => MaxI 7
Since: crdt-spice-plan C1
Internal definitions
__mmw-loop-- internal: fold b's entries into acc.__join-all-loop-- internal: fold v[i..n) into acc with join.