Sort.base.go: def of bend-parallel@0.1.0.0 Import: import bend-parallel@0.1.0.0/sort.bend as Sort Lines 158-169 of bend-parallel@0.1.0.0/sort.bend: https://jend.leeeet.dev/read.txt?path=bend-parallel@0.1.0.0/sort.bend&start_line=158&end_line=169 import Base # r holds the table and x, the entry a row (step) above at, which holds # the group's running sum through that row: at becomes s + x, and so up # for the n rows above; the group's first row, the next above, becomes s. def base.go(+n: Nat, +at: U32, +step: U32, +s: U32, r: Array & U32) -> Array: match n: case 0n: (t, +x) = r base.fin((at - step : U32), s, t[at] <- (s + x : U32)) case 1n+p: (t, +x) = r +q = (at - step : U32) base.go(p, q, step, s, (t[at] <- (s + x : U32))[(q - step : U32)]) Uses (10): 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=Array.set 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 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.sub https://jend.leeeet.dev/definition.txt?path=bend-parallel@0.1.0.0/sort.bend&name=base.fin