Perl6 hyper » 操作符不像地图那样工作 [英] Perl6 hyper » operator doesn't work like map
本文介绍了Perl6 hyper » 操作符不像地图那样工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
据我所知,超级运算符 »
是 map()
的快捷方式.为什么以下返回两个不同的结果并且在第二个示例中 .sum
似乎没有应用?
As far as I undertand it, the hyper operator »
is a shortcut for map()
. Why does the following return two different results and in the second example .sum
seems not to be applied?
say ([1,2], [2, 2], [3, 3]).map({.sum});
# (3 4 6)
say ([1,2], [2, 2], [3, 3])».sum;
# ([1 2] [2 2] [3 3])
推荐答案
Hyperops 递归下降到子列表中.他们也是自动线程 (NYI) 的候选者,这意味着他们的操作是无序的.
Hyperops descend recursively into sublists. Also they are candidates for autothreading (NYI) what means their operations are out of order.
还有一个错误已通过 https://github.com/rakudo/rakudo 修正/commit/c8c27e93d618bdea7de3784575d867d9e7a2f6cb .
Also there was a bug that is corrected with https://github.com/rakudo/rakudo/commit/c8c27e93d618bdea7de3784575d867d9e7a2f6cb .
say ([1,2], [2, 2], [3, 3])».sum;
# (3 4 6)
这篇关于Perl6 hyper » 操作符不像地图那样工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文