Operators
Feed operators ==> and <==
FullPipe data through a chain of list operations, left-to-right or right-to-left.
The feed operators pass a list through a series of stages, like a shell pipeline. ==> flows left-to-right (data first, then each stage); <== flows right-to-left. They make a map/grep/sort chain read in processing order.
Forward feed — ==> #
Each ==> feeds its left side as the final argument of the next stage; a terminal ==> my @var collects the result.
(1..10) ==> grep(* %% 2) ==> my @evens; say @evens;
Output
[2 4 6 8 10]Chain as many stages as you like:
<c a b> ==> map(*.uc) ==> sort() ==> my @s; say @s;
Output
[A B C]Backward feed — <== #
<== reads right-to-left — the source is on the right, and data flows up the chain into the variable on the left.
my @r <== map(* * 10) <== (1, 2, 3); say @r;
Output
[10 20 30]Notes #
- Feeds bind very loosely, so an assignment
=inside a feed source captures the source before the feed runs — use the terminal==> my @varform (as above) rather thanmy @var = source ==> stage. ==>reads in data-flow order (source → transforms → sink);<==mirrors the way nested calls already nest, just spaced out.- Each stage is an ordinary list routine; the feed only supplies the final argument, so
grep(* %% 2)andmap(*.uc)are written exactly as normal calls.