gtransducer

Types

pub type Transducer(a, b, r) =
  fn(fn(r, b) -> r) -> fn(r, a) -> r

Functions

pub fn compose(
  t1: fn(fn(a, b) -> a) -> fn(a, c) -> a,
  t2: fn(fn(a, d) -> a) -> fn(a, b) -> a,
) -> fn(fn(a, d) -> a) -> fn(a, c) -> a
pub fn filtering(
  pred: fn(a) -> Bool,
) -> fn(fn(b, a) -> b) -> fn(b, a) -> b
pub fn mapping(
  f: fn(a) -> b,
) -> fn(fn(c, b) -> c) -> fn(c, a) -> c
pub fn parallel_reduce(
  data data: List(a),
  initial initial: b,
  transducer transducer: fn(fn(b, c) -> b) -> fn(b, a) -> b,
  reducer reducer: fn(b, c) -> b,
  combiner combiner: fn(b, b) -> b,
  neutral_element neutral_element: fn() -> b,
  num_workers num_workers: Int,
) -> b
pub fn reduce(
  data data: List(a),
  initial initial: b,
  transducer transducer: fn(fn(b, c) -> b) -> fn(b, a) -> b,
  reducer reducer: fn(b, c) -> b,
) -> b
Search Document