def take

bend-lawful-stdlib@0.1.0.0 · src/float/bin.bend:271

import bend-lawful-stdlib@0.1.0.0/src/float/bin.bend as Bin
import Base

271# the low k bits of a word as a Bin, and the word that remains
272def take(k: Nat, -r: Nat, w: Word(Nat.add(k, r))) -> Bin & Word(r):
273  match k:
274    case 0n:
275      (BZ{}, w)
276    case 1n+j:
277      match w:
278        case WCon{b, t}:
279          take.cons(r, b, take(j, r, t))

Uses (8)

Used by (2)