I tried this--from your original file, not your most recent attempt--and
couldn't get it to work. If you look below, "mothera" never gets excluded,
except the last test (Exclude4), which is the control case (single regex,
no any junction):

my @exclude1 = ( rx/<|w>mothera$/, rx/<|w>camel$/ );
my @files1 = find( dir => $loc, type => 'file', exclude => @exclude1>>.any
);
say "Exclude1: ", @files1;
#Exclude1: ["/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]
#
my $exclude2 = ( rx/<|w>mothera$/, rx/<|w>camel$/ );
my @files2 = find( dir => $loc, type => 'file', exclude => any($exclude2) );
say "Exclude2: ", @files2;
#Exclude2: [any(("/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))]
#
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]
#
my $exclude4 = ( rx/mothera/ );
my @files4 = find( dir => $loc, type => 'file', exclude => $exclude4 );
say "Exclude4: ", @files4;
#Exclude4: ["/Users/me/test_folder/.DS_Store".IO
"/Users/me/test_folder/godzilla".IO "/Users/me/test_folder/rhodan".IO]


HTH, Bill.



On Fri, May 21, 2021 at 1:41 PM Joseph Brenner <doom...@gmail.com> wrote:

> > I just gave a few other variants a try-- passing a junction in a
> variable, passing a code block containing a function-- without any
> luck.
>
> Sorry, I mean a code block containing a *junction* or course.
>
> Like:
>
>       my @exclude = ( rx/<|w>mothera$/, rx/<|w>camel$/ );
>       my $any_exclude = any(@exclude);
>       my @files = find( dir => $loc, type => 'file', exclude => {
> $any_exclude } );
>       say @files;
>       # ["/home/doom/tmp/monster_island/godzilla".IO
> "/home/doom/tmp/monster_island/mothera".IO
> "/home/doom/tmp/monster_island/rhodan".IO]
>
>
> On 5/21/21, Joseph Brenner <doom...@gmail.com> wrote:
> > Thanks, yes the actual result is certainly consistent with the
> > junction applied at the top level, and not internally, which is what I
> > was expecting.
> >
> > Is there actually no way to pass a junction in to a function so that
> > it can be used later in an internal smartmach?   That's been my rough
> > impression of what junctions are for, a way to have a compound value
> > that's treated as a single one until it's used.
> >
> > I just gave a few other variants a try-- passing a junction in a
> > variable, passing a code block containing a function-- without any
> > luck.
> >
>

Reply via email to