# Link to this section Summary

## Functions

Given a list, it returns `{:ok, list}` if every element of the list is different from nil or `{:error, _}`. Otherwise `{:error, :nil_found}` is returned.

Given a predicate, a function of arity 1, and a value, the function is applied repeatedly until the predicate applied to the value returns either `nil`, `false`, or `{:error, _}`. The list of results is returned.

Given two lists and a function of arity 2, the lists are first zipped and then each tuple is applied (curried) to the function.

# Link to this section Types

Link to this type

# fun1()

`@type fun1() :: (any() -> any())`
Link to this type

# fun2()

`@type fun2() :: (any(), any() -> any())`

# Link to this section Functions

Link to this function

# sequence(a)

`@spec sequence([any()]) :: {:ok, [any()]} | {:error, any()}`

Given a list, it returns `{:ok, list}` if every element of the list is different from nil or `{:error, _}`. Otherwise `{:error, :nil_found}` is returned.

## examples Examples

``````iex> sequence([1, 2])
{:ok, [1, 2]}

iex> sequence([1, nil, 3])
{:error, :nil_found}

iex> sequence([{:ok, 1}, {:ok, 2}])
{:ok, [1, 2]}

iex> sequence([{:ok, 1}, {:error, 2}, {:ok, 3}])
{:error, 2}

iex> sequence([{:error, 1}, {:error, 2}])
{:error, 1}``````
Link to this function

# until(p, f, a)

`@spec until(fun1(), fun1(), any()) :: [any()]`

Given a predicate, a function of arity 1, and a value, the function is applied repeatedly until the predicate applied to the value returns either `nil`, `false`, or `{:error, _}`. The list of results is returned.

## examples Examples

``````iex> until(fn a -> a < 10 end, &(&1 + 1), 0)
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]``````
Link to this function

# zip_with(a, b, f)

`@spec zip_with([any()], [any()], fun2()) :: [any()]`

Given two lists and a function of arity 2, the lists are first zipped and then each tuple is applied (curried) to the function.

## examples Examples

``````iex> zip_with([1, 2, 3], [4, 5, 6], &Kernel.+/2)
[5, 7, 9]``````