# New Ticket Created by  Brad Gilbert 
# Please include the string:  [perl #130886]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=130886 >


This prints the numbers 1 to 9 then fails with a constraint error

    my \one-out-of-ten = 
(|(False,False,False,False,False,False,False,False,False,True) xx *).iterator;

    multi sub rarely ( $_ where one-out-of-ten.pull-one ){ say "test $_"; 
nextsame}
    multi sub rarely ( $_ ) { .say }

    (1..100).map: &rarely;

If I switch it so that it usually matches it doesn't fail

    my \nine-out-of-ten = 
(|(False,True,True,True,True,True,True,True,True,True) xx *).iterator;

    multi sub often ( $_ where nine-out-of-ten.pull-one ){ say "test $_"; 
nextsame }
    multi sub often ( $_ ) { .say }

    (1..100).map: &often;

It does seem as if the constraint is being called twice
because the first skip is on 5.



The reason I stumbled across this I thought something like this
could be good for logging one out of every ten inputs.

Reply via email to