【发布时间】:2019-01-31 18:05:18
【问题描述】:
这是解决previous question的另一种方法
my @bitfields;
for ^3 -> $i {
@bitfields[$i] = Bool.pick xx 3;
}
my @total = [\Z+] @bitfields;
say @total;
它应该将每一行压缩添加到下一行,并累积值。但是,这会产生错误
The iterator of this Seq is already in use/consumed by another Seq
(you might solve this by adding .cache on usages of the Seq, or
by assigning the Seq into an array)
in block <unit> at vanishing-total.p6 line 8
知道如何解决这个问题吗?
【问题讨论】:
-
这对我来说似乎是一个错误:因为您没有在代码中明确使用任何
Seq,所以您应该没有办法让这个错误发生。请创建一个问题。 -
解决方法:
([\Z+] @bitfields).map(*.list);不确定这是否真的是一个错误 - 序列是由Z创建的
标签: raku