3 ms·
Or if you like pipelines as much as I do, you can write it as: [:a, :b, :c] |> Enum.with_index |> Enum.each(fn({item, counter}) -> IO.puts("#{counter}
by shadeless 10y ago
Or if you like pipelines as much as I do, you can write it as:
[:a, :b, :c]
|> Enum.with_index
|> Enum.each(fn({item, counter}) -> IO.puts("#{counter} -> #{item}") end)
- sanderjd 10y agoThis is interesting. I'm a huge fan of pipelines like that and I think they're unmatched for being able to compose operations well, but I prefer the non-pipelines version of what is basically just an imperative loop.