my @nested = 1, (2, 3), 4;
say @nested;
say "elements: {@nested.elems}";[1 (2 3) 4]
elements: 3
July 4, 2026
Part of I. A Diurnal Cipher of Raku.
Yesterday we learned that context dictates how many values flow through an expression. Today, we confront flattening—the metaphysical law deciding whether a nested collection retains its singular, isolated ego or dissolves into the greater collective.
By default, Raku respects the boundaries of form. A list placed inside another list remains stubbornly cloistered within its own dimension:
Observe the horror of the architecture: the middle entity is a single List occupying a solitary slot. The array counts three top-level elements, blindly ignoring the inner duality.
The prefix | is a cosmic solvent. When applied, it transmutes a rigid list into a Slip—shattering its outer shell and splicing its inner components directly into the surrounding context, one level deep.
Though the digits on the right remain identical, their structural integrity has collapsed. The array now holds four distinct, liberated elements.
The Slip is indispensable when an array already harbor data, and you wish to merge its contents elsewhere without trapping them in a recursive prison:
This pattern manifests wherever streams of data converge: when gathering arguments for a grand invocation, building matrices from fractured columns, or synthesizing partial results.
This dissolution of form also governs the boundaries of subroutines. A slurpy parameter acts as a localized black hole, absorbing all remaining arguments into a single, cohesive array:
While the * prefix on @nums utilizes a different runic syntax, the underlying philosophy is unchanged: allowing a torrent of individual entities to expand and fill the available voids.
Once your mind accepts the reality-warping nature of |, invocations like some-func(|@args) and structural unions like [|@left, |@right] will no longer seem alien. It is the vital connective tissue between Raku’s structured vessels and the hungry voids that demand raw, individual values.