BitTree.shape_ok: def of mylsm-lsm-store@0.6.0.1 Import: import mylsm-lsm-store@0.6.0.1/src/BitTree.bend as BitTree Lines 223-238 of mylsm-lsm-store@0.6.0.1/src/BitTree.bend: https://jend.leeeet.dev/read.txt?path=mylsm-lsm-store@0.6.0.1/src/BitTree.bend&start_line=223&end_line=238 import Base # Structural checker for the exact perfect-tree shape described by metadata. def shape_ok(+height: Nat, tree: WordTree) -> Bool: match height tree: case 0n Empty{}: False{} case 0n Leaf{word}: True{} case 0n Fork{left, right}: False{} case 1n+h Empty{}: False{} case 1n+h Leaf{word}: False{} case 1n+h Fork{left, right}: a b = shape_ok(h, left) shape_ok(h, right) Bool.and(a, b) Uses (4): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.and https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/BitTree.bend&name=WordTree