Re: Proposal: use ampersand expression with anonymous functions

49 views
Skip to first unread message
Message has been deleted

Fernando Tapia Rico

unread,
Aug 17, 2018, 6:21:29 AM8/17/18
to elixir-lang-core
You can simply pass the function in that use case.

f = fn x -> x*2 end
Enum.map([1,1,1], f)


On Friday, August 17, 2018 at 12:19:31 PM UTC+2, Jakub G wrote:
It is possible to add support for using local defined functions in ampersand notation?

Example:
f = fn x -> x*2 end
Enum.map([1,1,1], &f/1)

It would really simplify those
&f.(&1)
calls, especially with functions passed as function arguments.


Jakub G

unread,
Aug 17, 2018, 6:56:56 AM8/17/18
to elixir-lang-core
Thank you, it simplified my code a bit.
Can somebody remove this topic now?
Reply all
Reply to author
Forward
0 new messages