Larry Wall larry-at-wall.org |Perl 6| wrote:

And since the "when" modifier counts as a conditional, you can rewrite

    grep Dog, @mammals

as

    $_ when Dog for @mammals;

So perhaps will see a lot of subtypes used this way:
    subset Odd if Int where { $_ % 2 };
    @evens = ($_ * 2 when Odd for 0..*);



   @primes = do $_ if prime($_) for 1..100;

becomes

   @primes = $_ when prime($_) for 1..100;

?

Not sure that is any better.


Reply via email to