gpt4 book ai didi

elixir - Elixir 中有恒等函数吗?

转载 作者:行者123 更新时间:2023-12-03 01:28:03 24 4
gpt4 key购买 nike

Elixir 是否已经定义了恒等函数?

类似于:

identity = fn a -> a end

最佳答案

@focused 是正确的 - 1.10-dev 添加了身份功能。

Documentation

旧答案:还没有预定义这样的函数(至少我知道)。它可以像您在问题中所做的那样简单地编写,或者更简洁地编写为 &(&1)

关于elixir - Elixir 中有恒等函数吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35616191/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com