Array.Arrays.is_perfect: def of bend-osdev-array@0.1.0.1 Import: import bend-osdev-array@0.1.0.1/array.bend as Array Lines 22-33 of bend-osdev-array@0.1.0.1/array.bend: https://jend.leeeet.dev/read.txt?path=bend-osdev-array@0.1.0.1/array.bend&start_line=22&end_line=33 import Base # whether a is a perfect tree of depth d (every leaf at depth d), the shape # Array.new builds and Array.set keeps def Arrays.is_perfect(-T: Type, +d: Nat, a: Array) -> Bool: match d a: case 0n ALeaf{x}: True{} case 0n ANode{xs, ys}: False{} case 1n+p ALeaf{x}: False{} case 1n+p ANode{xs, ys}: Bool.and(Arrays.is_perfect(T, p, xs), Arrays.is_perfect(T, p, ys)) Uses (4): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Array 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