You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/Type/Any.pod6
+38-34Lines changed: 38 additions & 34 deletions
Original file line number
Diff line number
Diff line change
@@ -117,10 +117,10 @@ Defined as:
117
117
118
118
method push(|values --> Positional:D)
119
119
120
-
The method push is defined for undefined invocants and allows for
121
-
autovivifying undefined to an empty L<Array|/type/Array>, unless the undefined value
122
-
implements L<Positional|/type/Positional> already. The argument provided will then be pushed
123
-
into the newly created Array.
120
+
The method push is defined for undefined invocants and allows for autovivifying
121
+
undefined to an empty L<Array|/type/Array>, unless the undefined value
122
+
implements L<Positional|/type/Positional> already. The argument provided will
123
+
then be pushed into the newly created Array.
124
124
125
125
my %h;
126
126
say %h<a>; # OUTPUT: «(Any)» <-- Undefined
@@ -193,9 +193,10 @@ Defined as:
193
193
194
194
method deepmap(&block --> List) is nodal
195
195
196
-
C<deepmap> will apply C<&block> to each element and return a new L<List|/type/List> with
197
-
the return values of C<&block>, unless the element does the L<Iterable|/type/Iterable> role.
198
-
For those elements L<deepmap|/routine/deepmap> will descend recursively into the sublist.
196
+
C<deepmap> will apply C<&block> to each element and return a new
197
+
L<List|/type/List> with the return values of C<&block>, unless the element does
198
+
the L<Iterable|/type/Iterable> role. For those elements
199
+
L<deepmap|/routine/deepmap> will descend recursively into the sublist.
199
200
200
201
say [[1,2,3],[[4,5],6,7]].deepmap(* + 1);
201
202
# OUTPUT: «[[2 3 4] [[5 6] 7 8]]»
@@ -232,19 +233,25 @@ number 3 and squared. In the next case, however
232
233
say [[1,2,3],[[4,5],6.1,7.2]].duckmap( -> Rat $_ { $_²} );
233
234
# OUTPUT: «[[1 2 3] [[4 5] 37.21 51.84]]»
234
235
235
-
3-item lists are not C<Rat>, so it descends recursively, but eventually only applies the operation to those that walk (or slither, as the case may be) like a C<Rat>.
236
+
3-item lists are not C<Rat>, so it descends recursively, but eventually only
237
+
applies the operation to those that walk (or slither, as the case may be) like a
238
+
C<Rat>.
236
239
237
-
Although on the surface (and name), C<duckmap> might look similar to L<C<deepmap>|/routine/deepmap>, the latter is applied recursively regardless of the type of the item.
240
+
Although on the surface (and name), C<duckmap> might look similar to
241
+
L<C<deepmap>|/routine/deepmap>, the latter is applied recursively regardless of
242
+
the type of the item.
238
243
239
244
=head2method nodemap
240
245
241
246
Defined as:
242
247
243
248
method nodemap(&block --> List) is nodal
244
249
245
-
C<nodemap> will apply C<&block> to each element and return a new L<List|/type/List> with
246
-
the return values of C<&block>. In contrast to L<deepmap|/routine/deepmap> it will B<not> descend
247
-
recursively into sublists if it finds elements which L<does|/routine/does> the L<Iterable|/type/Iterable> role.
250
+
C<nodemap> will apply C<&block> to each element and return a new
251
+
L<List|/type/List> with the return values of C<&block>. In contrast to
252
+
L<deepmap|/routine/deepmap> it will B<not> descend recursively into sublists if
253
+
it finds elements which L<does|/routine/does> the L<Iterable|/type/Iterable>
254
+
role.
248
255
249
256
say [[1,2,3], [[4,5],6,7], 7].nodemap(*+1);
250
257
# OUTPUT: «(4, 4, 8)»
@@ -459,8 +466,8 @@ Defined as:
459
466
460
467
method BagHash(--> BagHash:D) is nodal
461
468
462
-
Coerces the invocant to L<BagHash|/type/BagHash>, wherebyL<Positionals|/type/Positional>
463
-
are treated as lists of values.
469
+
Coerces the invocant to L<BagHash|/type/BagHash>, whereby
470
+
L<Positionals|/type/Positional>are treated as lists of values.
464
471
465
472
=head2method Set
466
473
@@ -477,8 +484,8 @@ Defined as:
477
484
478
485
method SetHash(--> SetHash:D) is nodal
479
486
480
-
Coerces the invocant to L<SetHash|/type/SetHash>, wherebyL<Positionals|/type/Positional>
481
-
are treated as lists of values.
487
+
Coerces the invocant to L<SetHash|/type/SetHash>, whereby
488
+
L<Positionals|/type/Positional>are treated as lists of values.
482
489
483
490
=head2method Mix
484
491
@@ -495,8 +502,8 @@ Defined as:
495
502
496
503
method MixHash(--> MixHash:D) is nodal
497
504
498
-
Coerces the invocant to L<MixHash|/type/MixHash>, wherebyL<Positionals|/type/Positional>
499
-
are treated as lists of values.
505
+
Coerces the invocant to L<MixHash|/type/MixHash>, whereby
506
+
L<Positionals|/type/Positional>are treated as lists of values.
500
507
501
508
=head2method Supply
502
509
@@ -516,13 +523,12 @@ Defined as:
516
523
multi sub min(+args, :&by!)
517
524
multi sub min(+args)
518
525
519
-
Coerces the invocant to L<Iterable|/type/Iterable> and returns the numerically smallest
520
-
element. In C<sub> form, the invocant is passed as an argument.
526
+
Coerces the invocant to L<Iterable|/type/Iterable> and returns the numerically
527
+
smallest element. In C<sub> form, the invocant is passed as an argument.
521
528
522
-
If a L<Callable|/type/Callable> positional argument is provided, each value is passed
523
-
into the filter, and its return value is compared instead of the
524
-
original value. The original value is still the one returned from
525
-
C<min>.
529
+
If a L<Callable|/type/Callable> positional argument is provided, each value is
530
+
passed into the filter, and its return value is compared instead of the original
531
+
value. The original value is still the one returned from C<min>.
526
532
527
533
say (1,7,3).min(); # OUTPUT:«1»
528
534
say (1,7,3).min({1/$_}); # OUTPUT:«7»
@@ -538,13 +544,12 @@ Defined as:
538
544
multi sub max(+args, :&by!)
539
545
multi sub max(+args)
540
546
541
-
Coerces the invocant to L<Iterable|/type/Iterable> and returns the numerically largest
542
-
element.
547
+
Coerces the invocant to L<Iterable|/type/Iterable> and returns the numerically
548
+
largest element.
543
549
544
-
If a L<Callable|/type/Callable> positional argument is provided, each value is passed
545
-
into the filter, and the return value is compared instead of the
546
-
original value. The original value is still the one returned from
547
-
C<max>.
550
+
If a L<Callable|/type/Callable> positional argument is provided, each value is
551
+
passed into the filter, and the return value is compared instead of the original
552
+
value. The original value is still the one returned from C<max>.
548
553
549
554
say (1,7,3).max(); # OUTPUT:«7»
550
555
say (1,7,3).max({1/$_}); # OUTPUT:«1»
@@ -562,10 +567,9 @@ Defined as:
562
567
563
568
Returns a C<Range> from the smallest to the largest element.
564
569
565
-
If a L<Callable|/type/Callable> positional argument is provided, each value is passed
566
-
into the filter, and its return value is compared instead of the
567
-
original value. The original values are still used in the returned
568
-
C<Range>.
570
+
If a L<Callable|/type/Callable> positional argument is provided, each value is
571
+
passed into the filter, and its return value is compared instead of the original
572
+
value. The original values are still used in the returned C<Range>.
0 commit comments