This:

$junction>>.say;

works the way it is because the junction is passed as an argument to the hyper 
operator where the normal rules apply. Try it this way:

say $junction>>.say;

and it will result in:

a
b
c
any((True), (True), (True))

Best regards,
Vadim Belman

> On May 23, 2021, at 4:12 PM, Joseph Brenner <doom...@gmail.com> wrote:
> 
> William Michels <w...@caa.columbia.edu> wrote:
> 
>> my $exclude3 = ( rx/<|w>mothera$/, rx/<|w>camel$/ );
>> my @files3 = find( dir => $loc, type => 'file', exclude => $exclude3>>.any
>> );
>> say "Exclude3: ", @files3;
>> #Exclude3: ["/Users/me/test_folder/.DS_Store".IO
>> "/Users/me/test_folder/godzilla".IO "/Users/me/test_folder/mothera".IO
>> "/Users/me/test_folder/rhodan".IO]
> 
> I wasn't really sure what bill was thinking there, because my
> impression was that junctions, by design aren't supposed to be
> treated as compound data structures, they're a *single* thing but
> with multiple values that co-exist with each other in
> "superposition".
> 
> For example, you can't get a count of the number of elements in a junction:
> 
>    my $junction = any( 'a', 'b', 'c' );
>    say $junction.elems; # any(1, 1, 1)
> 
> But then, this actually works:
> 
>    $junction>>.say;
>    # a
>    # b
>    # c
> 
> So going the other way, using a hyper operator to create a
> junction isn't such a silly thing to look at...
> 
> Though really then this idiom creates an array of multiple any
> junctions with single values, which would behave just like the
> individual values themselves:
> 
>    my $values = < A B C >;
>    my $junction2 = $values>>.any;
>    say $junction2;
>    # (any(A) any(B) any(C))
> 

Reply via email to