Please, why tableroA run without problem and tableroB get error "...protocol Enumerable not implemented for {1, 1, 1}" in the next code:
def tableroA do
### generamos la rejilla
s=Enum.to_list(1..9)
rejilla=for cada <- s, fila <-[1,2,3], col <- [1,2,3], do: {cada, fila, col}
convalor=Enum.map(rejilla, &({&1,2}))
Enum.into(convalor, HashDict.new)
end
def tableroB do
### generamos la rejilla
s=Enum.to_list(1..9)
for cada <- s, fila <-[1,2,3], col <- [1,2,3], do: {cada, fila, col}
|>Enum.map(&({&1,2}))
|>Enum.into(HashDict.new)
end
Due to precedence of
|>
operator your code is interpreted as:To resolve it, you can either put for comprehension in parentheses:
Or use explicit do/end blocks: