gs/par

Functions

pub fn par_map(
  stream: Stream(a),
  workers workers: Int,
  with mapper: fn(a) -> b,
) -> Stream(b)

Experimental parallel map operation over a stream.

Examples

let numbers = gs.from_list([1, 2, 3, 4, 5])
let doubled = 
  par_map(numbers, 
    workers: 2, 
    with: fn(x) { x * 2 }
  )
// -> #[2, 4, 6, 8, 10]

Warning: This is an experimental feature and should not be used in production!

Search Document