def count.go

bend-parallel@0.1.0.0 · histogram.bend:120

import bend-parallel@0.1.0.0/histogram.bend as Histogram
import Base

120# r holds the keys and the key x read at j: one more in x's bucket of the
121# row at row, then the same for the n keys after j. k1 is K - 1.
122def count.go(+n: Nat, +j: U32, +row: U32, +k1: U32, t: Array<U32>, r: Array<U32> & U32) -> Two:
123  match n:
124    case 0n:
125      (ks, +x) = r
126      Two{ks, bump((row + U32.min(x, k1) : U32), t)}
127    case 1n+p:
128      (ks, +x) = r
129      +q = (j + 1 : U32)
130      count.go(p, q, row, k1, bump((row + U32.min(x, k1) : U32), t), ks[q])

Uses (10)

Used by (1)