可以使用 gather 展开 Junctions 吗?
Can gather be used to unroll Junctions?
在这个程序中:
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
前面的 gather
如何改变 Junction 的行为,允许在其上创建循环? documentation 似乎没有反映出这种行为。这是规范吗?
由 jnthn 在 code and test 次提交中修复。
打高尔夫球:
do put .^name for any 1 ; # Int
put .^name for any 1 ; # Mu
可以使用十三个 statement prefixes listed in the doc 中的任何一个来代替 do
或 gather
,结果相同。 (supply
不出所料地没有产生任何输出,hyper
和 race
是转移注意力,因为它们尝试将方法应用于联结值但失败了。)
任何类型的连接都会产生相同的结果。
结点的任何数量的元素都会为 for
循环 产生相同的结果,而无需 语句前缀,即单个 Mu
。 带有语句前缀,for
循环重复主语句(put ...
)适当的次数。
我搜索了 rt 和 gh 问题,但没有找到相关的错误报告。
在这个程序中:
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
前面的 gather
如何改变 Junction 的行为,允许在其上创建循环? documentation 似乎没有反映出这种行为。这是规范吗?
由 jnthn 在 code and test 次提交中修复。
打高尔夫球:
do put .^name for any 1 ; # Int
put .^name for any 1 ; # Mu
可以使用十三个 statement prefixes listed in the doc 中的任何一个来代替 do
或 gather
,结果相同。 (supply
不出所料地没有产生任何输出,hyper
和 race
是转移注意力,因为它们尝试将方法应用于联结值但失败了。)
任何类型的连接都会产生相同的结果。
结点的任何数量的元素都会为 for
循环 产生相同的结果,而无需 语句前缀,即单个 Mu
。 带有语句前缀,for
循环重复主语句(put ...
)适当的次数。
我搜索了 rt 和 gh 问题,但没有找到相关的错误报告。