Hi all,

I use Perl6::Junction in Perl 5 and recently the author implemented the
"values" method on junctions.  I needed this because I sometimes find
that I need to do something conceptually similar to this:

  my $number = any( 0 .. 19 );
  while ($number->values) {
    my $rand int(rand(20));
    if ( $number == $random_number ) {

      # handle some task and discard the number
      $number = any( grep { $_ != $rand } $number->values );
    }
  }

In other words, sometimes I have code which receives a junction and
needs to provide a new junction based on the values of the old
junction, but with some values removed.

How do I do that in Perl 6?  I can't see that in the docs.  Clearly we
don't this to be done destructively as I suspect this will break
autothreading, but building new junctions based on old junctions seems
reasonable.

Cheers,
Ovid

--
Buy the book         - http://www.oreilly.com/catalog/perlhks/
Personal blog        - http://publius-ovidius.livejournal.com/
Tech blog            - http://use.perl.org/~Ovid/journal/
Official Perl 6 Wiki - http://www.perlfoundation.org/perl6 
Official Parrot Wiki - http://www.perlfoundation.org/parrot

Reply via email to