ParallelStream.Filter

The filter iterator implementation

Summary

Functions

Creates a stream that will apply the given function on enumeration in parallel and only pass the values for which the function returns truthy downstream

Creates a stream that will apply the given function on enumeration in parallel and only pass the values for which the function returns falsy downstream

Functions

filter(stream, mapper, options \\ [])

Creates a stream that will apply the given function on enumeration in parallel and only pass the values for which the function returns truthy downstream.

Options

These are the options:

  • :num_pipes – The number of parallel operations to run when running the stream.

Examples

Map and filter the even numbers:

iex> parallel_stream = 1..5 |> ParallelStream.filter(fn i -> i |> rem(2) == 0 end)
iex> parallel_stream |> Enum.to_list
[2,4]
reject(stream, mapper, options \\ [])

Creates a stream that will apply the given function on enumeration in parallel and only pass the values for which the function returns falsy downstream.

Options

These are the options:

  • :num_pipes – The number of parallel operations to run when running the stream.

Examples

Map and reject the even numbers:

iex> parallel_stream = 1..5 |> ParallelStream.reject(fn i -> i |> rem(2) == 0 end)
iex> parallel_stream |> Enum.to_list
[1,3,5]