def weight_balanced
import bend-kit-collections@0.1.4.1/LAWS.bend as LAWSimport Base
import bend-kit-collections@0.1.4.1/omap.bend as O
267def weight_balanced(-K: Data, -V: Data, m: O.OMap<K, V>) -> Bool:
268 match m:
269 case O.OTip{}:
270 True{}
271 case O.OBin{s, k, v, +lo, +hi}:
272 weight_ok(omap_weight(K, V, lo), omap_weight(K, V, hi))
273 && weight_balanced(K, V, lo) && weight_balanced(K, V, hi)