gpt4 book ai didi

scala - 在 Scala 中 => 是什么?

转载 作者:行者123 更新时间:2023-12-04 01:23:54 26 4
gpt4 key购买 nike

关闭。这个问题是opinion-based .它目前不接受答案。












想改善这个问题吗?更新问题,以便可以通过 editing this post 用事实和引文回答问题.

10 个月前关闭。




Improve this question




我知道 =>在 Scala 中用于函数字面量,意思是“将左边的东西转换成右边的东西”。但是这个符号实际上叫什么?等于,暗示,lambda?什么?

最佳答案

我记得在某处读过“火箭”这个词,可能是在书 Programming Scala 中。作者:Dean Wampler 和 Alex Payne。我找到了 this related answer from Bill Venners on a forum :

I asked Martin Odersky a while back what he called this, and he said "right arrow". Ron Hitchens suggested the name "bullet" to me a couple months ago. I used that here and there, but it didn't seem to stick. About 2 weeks ago I asked some Ruby guys what they call it, and they said "hash rocket". The reason for "hash" is Ruby uses it for mapping keys to value, i.e., "key => value" in Ruby is like "key -> value" in Scala (but untyped in Ruby), and of course -> in Scala is a library abstraction, not part of the language.

So I suggest we call it "rocket". It's more exciting and less violent than bullet, and we can put an adjective in there to differentiate the various uses in Scala: there's "function rocket" in anonymous functions, maybe a "case rocket" in a case clause in match expression or partial function, etc.


所以奥德斯基使用的“官方”术语是“右箭头”。

关于scala - 在 Scala 中 => 是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14129237/

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