Packages

Funny (and inefficient) implementation of linked lists in Elixir language

Current section

Files

Jump to
ex_list lib ex_list protocols collectable.ex
Raw

lib/ex_list/protocols/collectable.ex

defimpl Collectable, for: ExList.Backends.Struct do
use ExList, backend: :struct
def into(original) do
fun = fn
ex_list, {:cont, x} -> list(x, ex_list)
ex_list, :done -> original |> ExList.concat(ex_list |> ExList.reverse())
_, :halt -> :ok
end
{list(), fun}
end
end