Reputation: 11274
I have a single element/number that I am piping to Enum.into([])
but Elixir throws ** (Protocol.UndefinedError) protocol Enumerable not implemented for 90
90 |> Enum.into([])
v = 65
v |> Enum.into([]) Enumerable not implemented for 65
Upvotes: 5
Views: 1021
Reputation: 1
iex(1)> n = [1]
[1]
iex(2)> Enum.into(n, [ ])
[1]
iex(3)> n |> Enum.into([ ])
[1]
Upvotes: -1
Reputation: 9109
Enum.into/2 expects an Enumerable as the first argument, hence the error.
To pipe a Single Element into a list, use List.wrap
65 |> List.wrap
Upvotes: 10