> On 20 Oct 2018, at 17:50, Joseph Brenner <doom...@gmail.com> wrote:
>
> By the way, I'd really like to know what the vertical bar is here in
> front of "CORE":
>
>> for (|CORE::) .grep({ .key eq .value.^name }) .map( *.value ) -> $class {
>
> It's not the "any" junction, is it? How would that make sense here?
I think it’s a case of superstitious parentheses and slipping. It seems to
work fine with just:
for CORE:: .grep…
More generally: a prefix:<|> indicates slipping the given thing. For instance:
$ 6 'my @a = ^10; my @b = 10..^20; for @a, @b { say $_ }'
[0 1 2 3 4 5 6 7 8 9]
[10 11 12 13 14 15 16 17 18 19]
so it would just iterate twice. A prefix:<|> would slip the arrays:
$ 6 'my @a = ^10; my @b = 10..^20; for |@a, |@b { say $_ }'
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
iterating over the elements of each array.
Liz