在此程序中:
use v6;
my $j = +any "33", "42", "2.1";
gather for $j -> $e {
say $e;
} # prints 33422.1
for $j -> $e {
say $e; # prints any(33, 42, 2.1)
}
gather
前面的for
如何更改结点的行为,从而允许在结点上创建循环? documentation似乎不反映该行为。那是规格吗?
Golfed:
do put .^name for any 1 ; # Int
put .^name for any 1 ; # Mu
13个statement prefixes listed in the doc中的10个中的任何一个都可以代替do
或gather
使用,但结果相同。 (supply
不会产生任何输出,hyper
和race
是红色鲱鱼,因为它们尝试将方法应用于结点值的尝试失败了。)
任何类型的结点都会产生相同的结果。
联结的任何数量的元素都会为for
循环产生相同的结果没有语句前缀,即单个Mu
。 With在for
循环之前加一个语句前缀,将主语句(put ...
)重复适当的次数。
我同时搜索了rt和gh问题,但未找到相关的错误报告。