def grab.go

bend-kit-archive@0.5.1.0 · archive.bend:30

import bend-kit-archive@0.5.1.0/archive.bend as Archive
import Base
import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes

30# n bytes from i as a list. Callers keep i + n within the buffer.
31def grab.go(k: Nat, r: Array<U32> & U32, +j: U32, acc: List<&2, U32>) -> Array<U32> & List<&2, U32>:
32  match k:
33    case 0n:
34      (a, v) = r
35      (a, acc)
36    case 1n+p:
37      (a, +v) = r
38      grab.go(p, Bytes.peek(a, (j - 1 : U32)), (j - 1 : U32), Con{v, acc})

Uses (8)

Used by (1)