def Word.to_nat

Base · base.bend:1434

import Base
1434def Word.to_nat(n: Nat, w: Word(n)) -> Nat:
1435  match n:
1436    case 0n:
1437      0n
1438    case 1n+p:
1439      match w:
1440        case WCon{False{}, t}:
1441          Nat.double(Word.to_nat(p, t))
1442        case WCon{True{}, t}:
1443          1n+Nat.double(Word.to_nat(p, t))

Uses (5)

Used by (305)