#!env raku multi combine (@a, $b) { if @a[0] ~~ Int and @a[1] ~~ Int { return [ @a, [@a[0], $b] ]; } [|@a, [@a[0][0], $b]] }; multi combine ($a, $b) { $[$a, $b]; }; (reduce &combine, 1..8).raku.say;