method deepmap
Documentation for method deepmap
assembled from the following types:
class Any
From Any
(Any) method deepmap
Defined as:
method deepmap(&block --> List) is nodal
deepmap
will apply &block
to each element and return a new List with the return values of &block
, 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]]»
In the case of Associative
s, 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}»