def take
import bend-lawful-stdlib@0.1.0.0/src/float/bin.bend as Binimport 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))