Histogram.rows: def of bend-parallel@0.1.0.0 Import: import bend-parallel@0.1.0.0/histogram.bend as Histogram Lines 140-156 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=140&end_line=156 import Base # Pass 1's forks: d levels down to the blocks under block index i. fk and # ft are two handles each to the keys and the table. Block i reads only # its keys and reads and writes only its row (entries i * 2^kb to # i * 2^kb + K - 1): no two lanes touch one slot. def rows(+d: Nat, +i: U32, +e: Nat, +kb: Nat, +k: U32, fk: Array & Array, ft: Array & Array) -> Two: match d: case 0n: (ks, ks2) = fk (t, t2) = ft two.rejoin(ks2, t2, rows.leaf(i, e, kb, k, ks, t)) case 1n+p: (k0, k1) = fk (t0, t1) = ft +j = (i * 2 : U32) l r = rows(p, j, e, kb, k, Array.fork(U32, k0), Array.fork(U32, t0)) rows(p, (j + 1 : U32), e, kb, k, Array.fork(U32, k1), Array.fork(U32, t1)) two.join(l, r) Uses (12): 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=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=Two https://jend.leeeet.dev/definition.txt?path=bend-parallel@0.1.0.0/histogram.bend&name=rows.leaf https://jend.leeeet.dev/definition.txt?path=bend-parallel@0.1.0.0/histogram.bend&name=two.join https://jend.leeeet.dev/definition.txt?path=bend-parallel@0.1.0.0/histogram.bend&name=two.rejoin