def par_reduce.list.top

bend-kit-concurrency@0.2.0.0 · concurrency.bend:99

import bend-kit-concurrency@0.2.0.0/concurrency.bend as Concurrency
import Base

99def par_reduce.list.top(~A: Data, ~f: A -> A -> A, d: Nat, +z: A, nx: Nat & List<A>) -> A:
100  match d:
101    case 0n:
102      (n, xs) = nx
103      fold(~A, ~f, xs, z)
104    case 1n+p:
105      (+n, xs) = nx
106      +h = Nat.div(n, 2n)
107      par_reduce.list.go(~A, ~f, p, h, Nat.sub(n, h), z, split(A, xs, h))

Uses (9)

Used by (1)