def digit

yaml-for-bend@0.1.1.0 · num.bend:22

import yaml-for-bend@0.1.1.0/num.bend as Num
import Base

22# A digit's value, for digits up to base 36 ("a" and "A" are 10).
23def digit(c: Char) -> Nat:
24  +x = code(c)
25  U32.to_nat(U32.sub(x, Bool.pick(U32, U32.is_ge(x, 97), 87, Bool.pick(U32, U32.is_ge(x, 65), 55, 48))))

Uses (8)

Used by (3)