In Any§

See primary documentation in context for routine deepmap.

method deepmap(&block --> Iterable) is nodal
sub    deepmap(&op, \obj --> Iterable)

deepmap will apply its argument (or first argument for the sub form) to each element and return a new Iterable with the return values of the argument, unless the element does the Iterable role. For those elements deepmap will descend recursively into the sublist.

say [[1,2,3],[[4,5],6,7]].deepmap(* + 1);
# OUTPUT: «[[2 3 4] [[5 6] 7 8]]␤»
say deepmap * + 1, [[1,2,3],[[4,5],6,7]];
# OUTPUT: «[[2 3 4] [[5 6] 7 8]]␤»

In the case of Associatives, it will be applied to its values:

{ what => "is", this => "thing", a => <real list> }.deepmap( *.flip ).say;
# OUTPUT: «{a => (laer tsil), this => gniht, what => si}␤»
say deepmap *.flip, {what=>'is', this=>'thing', a=><real list>};
# OUTPUT: «{a => (laer tsil), this => gniht, what => si}␤»