A.Vector.split_while

You're seeing just the function split_while, go back to A.Vector module for more information.
Link to this function

split_while(vector, fun)

View Source

Specs

split_while(t(val), (val -> as_boolean(term()))) :: {t(val), t(val)}
when val: value()

Splits vector in two at the position of the element for which fun returns a falsy value (false or nil) for the first time.

It returns a two-element tuple with two vectors of elements. The element that triggered the split is part of the second vector.

Is basically performing take_while/2 and drop_while/2 at once.

Runs in linear time.

Examples

iex> {taken, dropped} = A.Vector.new(1..10) |> A.Vector.split_while(fn x -> x < 7 end)
iex> taken
vec([1, 2, 3, 4, 5, 6])
iex> dropped
vec([7, 8, 9, 10])