Damian Conway wrote:
Can I suggest that an alternative solution might be the following:my knee-jerk reaction,
So an L2R array-processing chain is:
@out = @a ~> grep {...} ~> map {...} ~> sort;
There might also be a be special rule that, if the RHS is
a variable, the LHS is simply assigned to it. Allowing:
@a ~> grep {...} ~> map {...} ~> sort ~> @a;
Further suppose that <~ takes its right argument, and binds
it in the indirect object slot of the left argument, which
argument it then calls. So an R2L array-processing chain is:
@out = sort <~ map {...} <~ grep {...} <~ @a;
Or, under a special rule for variables on the LHS:
@out <~ sort <~ map {...} <~ grep {...} <~ @a;
That way, everything is still a method call, the ultra-low precedence of
<~ and ~> eliminate the need for parens, and (best of all) the expressions
actually *look* like processing sequences.
Damian
|> is evocative of pipelines in bash, etc...
<| is somewhat less evocative, but related to <(cat *) as a sub-process (in csh ??)
yours feels slightly less noisy, but also less familiar/mnemonic.