Scan.sum.go: def of bend-parallel@0.1.0.0 Import: import bend-parallel@0.1.0.0/scan.bend as Scan Lines 39-49 of bend-parallel@0.1.0.0/scan.bend: https://jend.leeeet.dev/read.txt?path=bend-parallel@0.1.0.0/scan.bend&start_line=39&end_line=49 import Base # r holds the array and the entry x read at j: adds x and the n entries # after it to s. Returns the array and the sum. def sum.go(+n: Nat, +j: U32, +s: U32, r: Array & U32) -> Array & U32: match n: case 0n: (a, +x) = r (a, (s + x : U32)) case 1n+p: (a, +x) = r +q = (j + 1 : U32) sum.go(p, q, (s + x : U32), a[q]) Uses (7): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Array https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Array.get https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Pair https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Sigma https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.add