Skip to content

Instantly share code, notes, and snippets.

@Tombarr
Created January 10, 2019 14:01
Show Gist options
  • Save Tombarr/402185c3002f9b6251d330cd0f13b471 to your computer and use it in GitHub Desktop.
Save Tombarr/402185c3002f9b6251d330cd0f13b471 to your computer and use it in GitHub Desktop.
Elixir Lambdas
# Lambdas with one parameter
[1, 2, 3] |> Enum.map(fn x -> x * x end) # [1, 4, 9]
# Lambdas with multiple parameters
[1, 2, 3] |> Enum.reduce(fn x, s -> x + s end) # 6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment