def in.go
import bend-parallel@0.1.0.0/scan.bend as Scanimport Base
64# As ex.go, but a[j] becomes the sum through it.
65def in.go(+n: Nat, +j: U32, +s: U32, r: Array<U32> & U32) -> Array<U32> & U32:
66 match n:
67 case 0n:
68 (a, +x) = r
69 +t = (s + x : U32)
70 (a[j] <- t, t)
71 case 1n+p:
72 (a, +x) = r
73 +q = (j + 1 : U32)
74 +t = (s + x : U32)
75 in.go(p, q, t, (a[j] <- t)[q])