Histogram.grp: def of bend-parallel@0.1.0.0 Import: import bend-parallel@0.1.0.0/histogram.bend as Histogram Lines 230-243 of bend-parallel@0.1.0.0/histogram.bend: https://jend.leeeet.dev/read.txt?path=bend-parallel@0.1.0.0/histogram.bend&start_line=230&end_line=243 import Base # Pass 2a's forks (sort.bend's too, with sc): d levels down to the lanes # under lane i, with two handles to the table. Lane i reads and writes # only its group's rows in its columns: no two lanes touch one slot. def grp(+d: Nat, +sc: Bool, +i: U32, +gc: Nat, +w: Nat, +m: Nat, +kb: Nat, +k: U32, ft: Array & Array) -> Array: match d: case 0n: (t, t2) = ft Array.join(U32, grp.leaf(sc, i, gc, w, m, kb, k, t), t2) case 1n+p: (t0, t1) = ft +j = (i * 2 : U32) l r = grp(p, sc, j, gc, w, m, kb, k, Array.fork(U32, t0)) grp(p, sc, (j + 1 : U32), gc, w, m, kb, k, Array.fork(U32, t1)) Array.join(U32, l, r) Uses (11): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Array https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Array.fork https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Array.join https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool 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.mul https://jend.leeeet.dev/definition.txt?path=bend-parallel@0.1.0.0/histogram.bend&name=grp.leaf