Enum

take_while/2

take_while(enumerable, fun)

Takes the elements from the beginning of the enumerable while fun returns a truthy value.