Created
July 18, 2018 17:28
-
-
Save toff63/9eeb473e8d523757a8f8ff5f27eb1649 to your computer and use it in GitHub Desktop.
Currying is not very straight forward in Elixir, but it is still doable
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
defmodule Math do | |
def sum(a,b), do: a+b | |
def add1(a) do | |
f = fn(a) -> sum(1,a) end | |
f.(a) | |
end | |
def three() do | |
f = fn() -> add1(2) end | |
f.() | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment