def half

bend-collections-laws-math@1.0.0.0 · spec/lib/common.bend:26

import bend-collections-laws-math@1.0.0.0/spec/lib/common.bend as Common
import Base

26# n div 2 and n mod 2, structurally
27def half(n: Nat) -> Nat:
28  match n:
29    case 0n:
30      0n
31    case 1n:
32      0n
33    case 2n+q:
34      1n+half(q)

Uses (1)

Used by (107)