I believe that is a perfectly fine solution. If you need to perform different operations on even and odd elements you could also try chunking the list.
E.g.
[1,2,3,4,5,6]
|> Enum.chunk_every(2)
# [[1,2], [3,4], [5,6]]
|> Enum.map(fn [first, second] -> [first*2, second*3] end)
|> List.flatten
# [2, 6, 6, 12, 10, 18]
That doubles every odd element and triples every even one.






















