简体   繁体   English

什么是灵丹妙药中的&+ / 2?

[英]What is &+/2 in elixir?

Saw this in elixir guide: 在灵药指南中看到这个:

Enum.reduce([1, 2, 3], 0, &+/2)

What the heck is &+/2 ? 到底是什么&+ / 2? I can't seem to google it for the life of me. 我似乎无法谷歌它为我的生活。

In this example you capture the module function +/2 . 在此示例中,您将捕获模块函数+/2 Capture operator & turns module function into anonymous one. 捕获操作&原来模块的功能为匿名之一。 Here it captures the +/2 , which is actually Kernel.+/2 . 它捕获+/2 ,实际上是Kernel.+/2 Read more here . 在这里阅读更多。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM