On 9/19/06, Trey Harris <[EMAIL PROTECTED]> wrote:
In a message dated Mon, 18 Sep 2006, Darren Duncan writes:
>  @filtered = @originals.where:{ .foo eq $bar };

Note that this can be written:

    @filtered = any(@originals) ~~ { .foo eq $bar};

This doesn't seem to be correct.

According to S03 junctions "thread through operations, returning
another junction representing the result". Instead of returning the
filtered values, this seems to allways return one of
   any(Bool::False)   # If all comparisons were false
   any(Bool::True)     # If all comparisons were true
   any(Bool::False, Bool::True) # If some comparisons were false and some true

Testing a concrete example in pugs (r13034):
   pugs> my @a = (1..10);
   (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
   pugs> any(@a) ~~ { $_ < 0 }
   (Bool::False)
   pugs> any(@a) ~~ { $_ > 0 }
   (Bool::True)
   pugs> any(@a) ~~ { $_ % 2 }
   (Bool::False | Bool::True)

--
Markus Laire

Reply via email to