Documentation for infix
<== assembled from the following types:
This leftward feed operator takes the result from the right and passes it to the previous (left) routine as the last parameter. This elucidates the right-to-left dataflow for a series of list manipulating functions.
# Traditional structure, read bottom-to-topmy =sort # (4) Sort, result is <Earth People>grep , # (3) Look for P or Emap , # (2) Capitalize the words<people of earth>; # (1) Start with the input# Feed (right-to-left) with parentheses, read bottom-to-topmy = (sort() # (4) Sort, result is <Earth People><== grep() # (3) Look for P or E<== map() # (2) Capitalize the words<== <people of earth> # (1) Start with the input);# To assign without parentheses, use another feed operatormy<== sort() # (4) Sort, result is <Earth People><== grep() # (3) Look for P or E<== map() # (2) Capitalize the words<== <people of earth>; # (1) Start with the input# It can be useful to capture a partial resultmy<== sort()<== grep()<== my @caps # unlike ==>, there's no need for additional statement<== map()<== <people of earth>;
Unlike the rightward feed operator, the result is not closely mappable to method-chaining. However, compared to the traditional structure above where each argument is separated by a line, the resulting code is more demonstrative than commas. The leftward feed operator also allows you to "break into" the statement and capture an intermediary result which can be extremely useful for debugging or to take that result and create another variation on the final result.
Note: In the future, this operator will see some change as it gains the ability to run list operations in parallel. It will enforce that the right operand is enclosable as a closure (that can be cloned and run in a subthread).