def fwd.go
import bend-parallel@0.1.0.0/sort.bend as Sortimport Base
232# r holds the table and the entry x read at at: it becomes s, and the n
233# entries after it (each step further on) follow, from s + x.
234def fwd.go(+n: Nat, +at: U32, +step: U32, +s: U32, r: Array<U32> & U32) -> Array<U32>:
235 match n:
236 case 0n:
237 (t, +x) = r
238 t[at] <- s
239 case 1n+p:
240 (t, +x) = r
241 +q = (at + step : U32)
242 fwd.go(p, q, step, (s + x : U32), (t[at] <- s)[q])