Funções nomeadas convertidas para anônima
&String.reverse/1# usando função anônima
Enum.map([1,2,3], fn x -> x * 2 end)
# [2, 4, 6]
# usando função nomeada
defmodule MyModule do
def math(x), do: x * 2
end
Enum.map([1,2,3], &MyModule.math/1)
# [2, 4, 6]Last updated