Saw this in elixir guide:
Enum.reduce([1, 2, 3], 0, &+/2)
What the heck is &+/2 ? I can't seem to google it for the life of me.
In this example you capture the module function +/2
. Capture operator &
turns module function into anonymous one. Here it captures the +/2
, which is actually Kernel.+/2
. Read more here .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.