Skip to content

Instantly share code, notes, and snippets.

@josevalim
Last active Aug 29, 2015
Embed
What would you like to do?
"foo bar baz"
|> Stream.unfold(fn
"" -> nil;
acc ->
case String.split(acc, " ", parts: 2) do
[left, right] -> {left, right}
[left] -> {left, ""}
end
end)
|> Enum.take(2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment