Skip to content

Instantly share code, notes, and snippets.

@Tombarr
Created January 19, 2019 23:22
Show Gist options
  • Save Tombarr/e7a51f2c7ba79b57e9040485785a7c09 to your computer and use it in GitHub Desktop.
Save Tombarr/e7a51f2c7ba79b57e9040485785a7c09 to your computer and use it in GitHub Desktop.
Functions as arguments in Elixir
add_ten = fn (x) -> x + 10 end
do_a_thing_to_x = fn (thing, x) ->
thing.(x)
end
do_a_thing_to_x.(add_ten, 10) # 20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment