Given this code: defmodule Foo do def bar(i), do: i * 2 end
anon = fn (i) -> i * 2 end import Foo Foo.bar(3) # 6 Foo.bar 3 # 6 bar(3) # 6 bar 3 # 6 (&bar/1).(3) # 6 anon.(3) # 6 3 |> Foo.bar() # 6 3 |> Foo.bar # 6 3 |> bar() # 6 3 |> bar # 6 3 |> (&bar/1).() # 6 3 |> anon.() # 6 Both are functions, one anonymous one defined in a module. Yet calling them is very different, starting with the dot before the parenthesis for the anonymous function. Also, you can't call it without parenthesis, unlike named functions Is there a reason for this distinction? If not, I propose to remove that distinction and have the call be the same. -- You received this message because you are subscribed to the Google Groups "elixir-lang-core" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/d24b8458-1510-4bbb-a284-868e91a3b758%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
