Created
January 10, 2019 14:01
-
-
Save Tombarr/402185c3002f9b6251d330cd0f13b471 to your computer and use it in GitHub Desktop.
Elixir Lambdas
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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