Created
January 19, 2019 23:07
-
-
Save Tombarr/9d934ab382fb8295d3c4ac7a994bd5f2 to your computer and use it in GitHub Desktop.
Map & Reduce with assignment in Elixir
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
arr = [1, 2, 3, 4, 5] | |
arr_sqrd = Enum.map(arr, fn x -> x * x end) | |
arr_sqrd_sum = Enum.reduce(arr_sqrd, fn x, s -> x + s end) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment