Damian Conway wrote:
So I'm going to go on to propose that we create a fifth class of
Junction: the "transjunction", with corresponding keyword C<every>.
[...]
say (^10 G[<] one(3,7));
3 4 5 6
which could also be:
say every(^10) < one(3,7);
# Every value up to 10 that's greater than 3 or 7 but not both
[...]
I just think those all read much better than the (otherwise excellent)
meta-operator. In much the same way that the existing junctive types
read better than their functional or operator-oriented alternatives.
I think that the two proposals are equivalent, in the sense that either
can be trivially implemented using the other. So it is indeed a question
of which one reads better and fits in better. And I agree, your C<every>
proposal does read better (at least to an English speaker).
However, I am a little concerned that the transjunction "magically"
changes an operator that returns a Boolean value into one that returns a
list. If the usage of a transjuction is non-local to its creation then
this could result in surprises, and hence frustrating debugging sessions.
If I wanted to write intentionally confusing code (which sometimes
happens due to carelessness) then I might take advantage of the fact
that C<every> is, in English, a synonym for C<all>, not C<any>:
if every(@values) < one(3..7) {...}
I'd like these in the core language (for performance and universal
accessibility), but if not, I already have a nearly-complete
implementation of a module implementing them, which runs successfully on
the current release of Rakudo*. I append said model for your amusement
(and suggestions!).
++
Dave.