Skip to content

Commit a1d7140

Browse files
author
Jan-Olof Hendig
committed
New examples for duckmap. Zoffix++
1 parent 68dbbe6 commit a1d7140

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

doc/Type/Any.pod6

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,10 @@ C<duckmap> will apply C<&block> on each element and return a new list with
174174
defined return values of the block. For undefined return values, C<duckmap>
175175
will try to descend into the element if that element implements C<Iterable>.
176176
177-
my @a = [1,[2,3],4];
178-
dd @a.duckmap({ $_ ~~ Int ?? $_++ !! Any });
179-
# OUTPUT: «(1, (2, 3), 4)␤»
177+
<a b c d e f g>.duckmap(-> $_ where <c d e>.any { .uc }).say;
178+
OUTPUT: «(a b C D E f g)␤»
179+
(('d', 'e'), 'f').duckmap(-> $_ where <e f>.any { .uc }).say;
180+
OUTPUT: «((d E) F)␤»
180181
181182
=head2 method flat
182183

0 commit comments

Comments
 (0)