I gave a talk on Perl 6 Junctions at the Thousand Oaks Perl Mongers
meeting last night

       http://www.hcoop.net/~terry/perl/talks/p6-junctions/index.html 
 
and two questions/desires came out of it: 
 
1: will it be possible to know which element of a junction is 
currently being used? E.g.: 
 
my @first_set = qw(1 1); 
my @new_set = qw(1 1.4 1 1 8 1 1 1 0.8); 
 
my $any_new_set = any(@new_set); 
my $any_first_set = any(@first_set); 
 
if ( (abs($any_first_set - $any_new_set)) > 0.5) { 
  "a variation in the readings is too large".say; 
  printf "we we examining %d and %d when it happened", 
      $any_new_set.current, $any_first_set.current ; # desired feature
      
} 
 
2: Unless the array of values can be specified lazily, it will not be 
practical to use Perl 6 Junctions on large datasets. For example  I
might like to be able to specify a sub ref/closure whose execution yields a
new array value or undef when no more values. I.e.:

sub mynext {
    my($age) = $sth->fetchrow_array;
    $age
}

my $junction = any(\&mynext) ;

3: Do junctions short circuit? I.e., whenever the condition is met,
does it continue immediately. Using the example from point #1, can we assume
that the body of the "then" branch will fire when 8 of @new_set is
encountered?

Reply via email to