Skip to content

Instantly share code, notes, and snippets.

@toff63
Created July 18, 2018 17:28
Show Gist options
  • Save toff63/9eeb473e8d523757a8f8ff5f27eb1649 to your computer and use it in GitHub Desktop.
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
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