def read_u

bendtorch@1.3.0.0 · dtype.bend:180

import bendtorch@1.3.0.0/dtype.bend as Dtype
import Base

180# the k + 1 values from index i, in order (ra holds the array and the value at i, already read)
181def read_u(k: Nat, +i: U32, acc: List<&2, U32>, ra: Array<U32> & U32) -> UL:
182  match k ra:
183    case 0n Tuple{a, v}:
184      UL{a, List.reverse(&2, U32, v <> acc)}
185    case 1n+p Tuple{a, +v}:
186      read_u(p, (i + 1 : U32), v <> acc, Array.get(U32, a, (i + 1 : U32)))

Uses (10)

Used by (3)