working_actors
working_actors is a simple library for spawning a group of actors as workers to run a specific function with one of a list of input arguments and collect the function output into a new list.
Note that the output list is not necessarily in the same order as the input list, so if it is necessary you should return a record with both the input argument and the output from the worker function.
Values
pub fn spawn_workers(
n_workers: Int,
tasks: List(a),
work_function: fn(a) -> b,
) -> List(b)
Spawn n_workers worker processes, each ready to run the work
function work_function. A list of arguments to the work_function
is provided as the tasks list. The functions will be called in
parallel until the work_function has been run with every argument
in the tasks list. A new list of the function return values will
be returned when all the tasks have run. This list will be in an
arbitrary order.