Skip to content

Instantly share code, notes, and snippets.

@pwightman
Last active February 18, 2020 17:04
Show Gist options
  • Save pwightman/d6fac395e3e8f4d38cd786a655fb94a6 to your computer and use it in GitHub Desktop.
Save pwightman/d6fac395e3e8f4d38cd786a655fb94a6 to your computer and use it in GitHub Desktop.
# Allows me to call Enum.map as a "pre-curried" func, kind of...
[1, 2, 3]
|> Enum.map(& &1 * 2)
# vs...
def my_map(list) do
fn transform ->
Enum.map(list, transform)
end
end
curried_func = my_map([1, 2, 3])
curried_func.(& &1 *2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment