From the documentation
duckmap
will apply&block
on each element and return a new list with defined return values of the block. For undefined return values,duckmap
will try to descend into the element if that element implementsIterable
.
But then:
my $list = [[1,2,3],[[4,5],6,7]];
say $list.deepmap( *² ); # [[1 4 9] [[16 25] 36 49]]
say $list.duckmap( *² ); # [9 9]
deepmap behaves pretty much as expected, but I can't really make any sense of what duckmap
is doing.
This question is related to this issue in perl6/doc. It can be solved with "They couldn't be more different", but I would like to find some examples where they do the same, and when they don't, try and understand really what's going on.