def KCounter.get
import bend-kit-crdt@0.2.0.0/crdt.bend as Crdtimport Base
233# The count of replica k: the largest count under an ID that cmp makes equal to k.
234def KCounter.get(~K: Data, ~cmp: K -> K -> Cmp, s: KCounter<K>, +k: K) -> U32:
235 match s:
236 case KNil{}:
237 0
238 case KCon{id, c, r}:
239 U32.max(KCounter.hit(cmp(k, id), c), KCounter.get(~K, ~cmp, r, k))