ExAequoFn.Stream (ExAequoFn v0.1.3)

View Source

Summary

Functions

Advances and returns head

Types

binary?()

@type binary?() :: maybe(binary())

either_t(error_t, ok_t)

@type either_t(error_t, ok_t) :: {:ok, ok_t} | {:error, error_t}

function_t()

@type function_t() :: (... -> any())

maybe(t)

@type maybe(t) :: nil | t

result_t(t)

@type result_t(t) :: {:ok, t} | :error

stream_t()

@type stream_t() :: %Stream{accs: term(), done: term(), enum: term(), funs: term()}

transformer_t()

@type transformer_t() :: (any() -> result_t(any()))

transformers_t()

@type transformers_t() :: [transformer_t()]

Functions

next(enum)

@spec next(Enumerable.t()) :: {any(), Enumerable.t()}

Advances and returns head

iex(1)> enum = 1..3
...(1)> {1, s} = next(enum)
...(1)> s |> Enum.to_list 
[2, 3]

At the end we get nil

iex(2)> {1, s} = next([1]) 
...(2)> next(s)
nil

zipn(streams)