perl6 / rakudo:无法解析postcircumfix:sym <()>
发布时间:2020-12-16 06:25:52 所属栏目:大数据 来源:网络整理
导读:为什么我收到此错误消息? #!perl6use v6;my @a = 1..3;my @b = 7..10;my @c = 'a'..'d';for zip(@a;@b;@c) - $nth_a,$nth_b,$nth_c { ... };# Output:# ===SORRY!===# Unable to parse postcircumfix:sym( ),couldn't find final ')' at line 9 解决方法 Ra
为什么我收到此错误消息?
#!perl6 use v6; my @a = 1..3; my @b = 7..10; my @c = 'a'..'d'; for zip(@a;@b;@c) -> $nth_a,$nth_b,$nth_c { ... }; # Output: # ===SORRY!=== # Unable to parse postcircumfix:sym<( )>,couldn't find final ')' at line 9 解决方法
Rakudo尚未实现lol(“列表列表”)表单,因此无法解析@a; @b; @c.出于同样的原因,zip还没有一个包含三个列表的表单.显然,错误消息不是很棒.
目前还没有一个好的解决方法,但是这里有一些可以完成工作的东西: sub zip3(@a,@b,@c) { my $a-list = flat(@a.list); my $b-list = flat(@b.list); my $c-list = flat(@c.list); my ($a,$b,$c); gather while ?$a-list && ?$b-list && ?$c-list { $a = $a-list.shift unless $a-list[0] ~~ ::Whatever; $b = $b-list.shift unless $b-list[0] ~~ ::Whatever; $c = $c-list.shift unless $c-list[0] ~~ ::Whatever; take ($a,$c); } } for zip3(@a,@c) -> $nth_a,$nth_c { say $nth_a ~ $nth_b ~ $nth_c; } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |