def half.go
import bend-ml-tensor-array@0.1.19.0/main.bend as BendMlTensorArrayimport Base
1491# n / 2 rounded down. A tail loop with an accumulator: a non-tail recursion here would put a
1492# continuation on every node of the band tree and keep the bands from running in parallel.
1493def half.go(n: Nat, acc: Nat) -> Nat:
1494 match n:
1495 case 0n:
1496 acc
1497 case 1n+p:
1498 match p:
1499 case 0n:
1500 acc
1501 case 1n+q:
1502 half.go(q, 1n+acc)