Operators

The slip operator |

Full

Flatten a list into the surrounding list, in place.

Prefix | turns a list into a Slip — a list that dissolves into its container. Where a nested list would stay nested, a slipped one merges its elements into the enclosing list.

Flattening in place #

my @a = 1, |(2, 3), 4;
say @a;
say (1, |(2, 3), 4).elems;
Output
[1 2 3 4]
4

Without the |, (2, 3) would be one nested element; slipped, its 2 and 3 sit directly in the list, so the total length is 4.

Notes #