Hacker News new | ask | show | jobs
by shadeless 3629 days 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)
1 comments

This 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.