Jonathan Scott Duff suggested:
> Oh, then we just need a syntax to split the streams. ... I know!
>
> @list ~| grep /bad!/ ~> @throw ~| grep /good/ ~> @keep;
Unfortunately, that's already taken (it's the bitwise-OR-on-a-string operator).
Fortunately that doesn't matter, since no extra binary operator is actually
needed to achieve the unzipping you desire.
All we need is a unary prefix form of ~>.
Unary ~> would (by analogy to unary dot) append the current topic to the
argument list of its operand.
Thus, your examples become simply:
given @list {
~> grep /bad!/ ~> @throw;
~> grep /good/ ~> @keep;
}
And:
given @list {
~> grep length == 1 ~> @onecharthings;
~> grep [0..29] ~> @numberslessthan30;
~> grep /^\w+$/ ~> @words;
~> grep $_%2==0 ~> @evennumbers;
}
Damian