Crdt.KCounter.merge.go: def of bend-kit-crdt@0.2.0.0 Import: import bend-kit-crdt@0.2.0.0/crdt.bend as Crdt Lines 241-253 of bend-kit-crdt@0.2.0.0/crdt.bend: https://jend.leeeet.dev/read.txt?path=bend-kit-crdt@0.2.0.0/crdt.bend&start_line=241&end_line=253 import Base # q is KCounter.heads(a, b). Passing it in lets match pick the step without closures. def KCounter.merge.go(~K: Data, ~cmp: K -> K -> Cmp, +a: KCounter, +b: KCounter, q: Cmp) -> KCounter: match a b q: case KNil{} _ _: b case KCon{x, c, r} KNil{} _: KCon{x, c, r} case KCon{+x, +c, +r} KCon{+y, +d, +t} LT{}: KCon{x, c, KCounter.merge.go(~K, ~cmp, r, KCon{y, d, t}, KCounter.heads(~K, ~cmp, r, KCon{y, d, t}))} case KCon{+x, +c, +r} KCon{+y, +d, +t} EQ{}: KCon{x, U32.max(c, d), KCounter.merge.go(~K, ~cmp, r, t, KCounter.heads(~K, ~cmp, r, t))} case KCon{+x, +c, +r} KCon{+y, +d, +t} GT{}: KCon{y, d, KCounter.merge.go(~K, ~cmp, KCon{x, c, r}, t, KCounter.head(~K, ~cmp, x, t))} Uses (5): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Cmp https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.max https://jend.leeeet.dev/definition.txt?path=bend-kit-crdt@0.2.0.0/crdt.bend&name=KCounter https://jend.leeeet.dev/definition.txt?path=bend-kit-crdt@0.2.0.0/crdt.bend&name=KCounter.head https://jend.leeeet.dev/definition.txt?path=bend-kit-crdt@0.2.0.0/crdt.bend&name=KCounter.heads