def mask

bend-collections-laws-math@1.0.0.0 · spec/lib/numeric.bend:109

import bend-collections-laws-math@1.0.0.0/spec/lib/numeric.bend as Numeric
import Base

109# The low k bits set, the rest clear.
110def mask(+n: Nat, +k: Nat) -> Word(n):
111  match n k:
112    case 0n _:
113      WNil{}
114    case 1n+p 0n:
115      WCon{False{}, mask(p, 0n)}
116    case 1n+p 1n+j:
117      WCon{True{}, mask(p, j)}

Uses (5)

Used by (2)