File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -215,12 +215,16 @@ Defined as:
215
215
216
216
C < duckmap > will apply C < &block > on each element that behaves in such a way that
217
217
C < &block > can be applied. If it fails, it will descend recursively if possible,
218
- or otherwise return the item without any transformation.
218
+ or otherwise return the item without any transformation. It will act on
219
+ values if the object is C < Associative > .
219
220
220
- <a b c d e f g>.duckmap(-> $_ where <c d e>.any { .uc }).say;
221
- # OUTPUT: «(a b C D E f g)»
222
- (('d', 'e'), 'f').duckmap(-> $_ where <e f>.any { .uc }).say;
223
- # OUTPUT: «((d E) F)»
221
+ = for code
222
+ <a b c d e f g>.duckmap(-> $_ where <c d e>.any { .uc }).say;
223
+ # OUTPUT: «(a b C D E f g)»
224
+ (('d', 'e'), 'f').duckmap(-> $_ where <e f>.any { .uc }).say;
225
+ # OUTPUT: «((d E) F)»
226
+ { first => ('d', 'e'), second => 'f'}.duckmap(-> $_ where <e f>.any { .uc }).say;
227
+ # OUTPUT: «{first => (d E), second => F}»
224
228
225
229
In the first case, it is applied to C < c > , C < d > and C < e > which are the ones that
226
230
meet the conditions for the block (C < { .uc } > ) to be applied; the rest are
You can’t perform that action at this time.
0 commit comments