Skip to content

Instantly share code, notes, and snippets.

@Tombarr
Created January 19, 2019 23:06
Show Gist options
  • Save Tombarr/43d71a064dc8b5444be35472c469246d to your computer and use it in GitHub Desktop.
Save Tombarr/43d71a064dc8b5444be35472c469246d to your computer and use it in GitHub Desktop.
Map & Reduce in Elixir
[1, 2, 3, 4, 5]
|> Enum.map(fn x -> x * x end)
|> Enum.reduce(fn x, s -> x + s end) # 55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment