Rod Adams writes: > >>Perhaps the easiest way to explain the difficulty here is to note that > >>executing a relational op (i.e. returning a boolean) value on a junction > >>argument returns a junction of boolean values. > > > > > >Is that so? Does Perl6 have some fundamental law of junction > >preservation? > >I would expect $matches to be either false or true---the junction values > >are garbage collected. > > You're both right. > > The junction of junctions of bools gets created from the threading... > and then gets collapsed into a single bool, based on the predicates.
Except that it doesn't. Not until it is evaluated in boolean context. any(0, 1) does not immediately collapse to 1. Without any other context, any(0, 1) means "any value which is either zero or one" and interprets the boolean value of nothing. You wouldn't expect perl to try to evaluate something as a boolean unless it's in some sort of boolean context, would you? The same holds for junctions. > It's been established before that getting at _which_ values in a > junctions made the evaluation turn one way or the other is _not_ > something that will be readily supported. I don't think that's been established. I think that's been stated as a consequence of the current semantics. I don't see any linguistic reason why junctions /should not/ support that. It's just that they don't (right now). Luke