@@ -89,8 +89,8 @@ Coercion to Bool also indicates if the List got any elements.
89
89
90
90
Defined as:
91
91
92
- multi sub elems($list --> Int:D)
93
- multi method elems(List:D: --> Int:D)
92
+ sub elems($list --> Int:D)
93
+ method elems(List:D: --> Int:D)
94
94
95
95
Returns the number of elements in the list.
96
96
@@ -100,8 +100,8 @@ Returns the number of elements in the list.
100
100
101
101
Defined as:
102
102
103
- multi sub end($list --> Int:D)
104
- multi method end(List:D: --> Int:D)
103
+ sub end($list --> Int:D)
104
+ method end(List:D: --> Int:D)
105
105
106
106
Returns the index of the last element.
107
107
@@ -111,8 +111,8 @@ Returns the index of the last element.
111
111
112
112
Defined as:
113
113
114
- multi sub keys($list --> Seq:D)
115
- multi method keys(List:D: --> Seq:D)
114
+ sub keys($list --> Seq:D)
115
+ method keys(List:D: --> Seq:D)
116
116
117
117
Returns a sequence of indexes into the list (e.g., 0..(@list.elems-1)).
118
118
@@ -122,8 +122,8 @@ Returns a sequence of indexes into the list (e.g., 0..(@list.elems-1)).
122
122
123
123
Defined as:
124
124
125
- multi sub values($list --> Seq:D)
126
- multi method values(List:D: --> Seq:D)
125
+ sub values($list --> Seq:D)
126
+ method values(List:D: --> Seq:D)
127
127
128
128
Returns a sequence of the list elements, in order.
129
129
@@ -134,8 +134,8 @@ Returns a sequence of the list elements, in order.
134
134
135
135
Defined as:
136
136
137
- multi sub kv($list --> Seq:D)
138
- multi method kv(List:D: --> Seq:D)
137
+ sub kv($list --> Seq:D)
138
+ method kv(List:D: --> Seq:D)
139
139
140
140
Returns an interleaved sequence of indexes and values. For example
141
141
@@ -145,8 +145,8 @@ Returns an interleaved sequence of indexes and values. For example
145
145
146
146
Defined as:
147
147
148
- multi sub pairs($list --> Seq:D)
149
- multi method pairs(List:D: --> Seq:D)
148
+ sub pairs($list --> Seq:D)
149
+ method pairs(List:D: --> Seq:D)
150
150
151
151
Returns a sequence of pairs, with the indexes as keys and the list values as
152
152
values.
@@ -157,7 +157,7 @@ values.
157
157
158
158
Defined as:
159
159
160
- multi method antipairs(List:D: --> Seq:D)
160
+ method antipairs(List:D: --> Seq:D)
161
161
162
162
Returns a L < Seq|/type/Seq > of pairs, with the values as keys and the indexes as
163
163
values, i.e. the direct opposite to L < pairs|/type/List#routine_pairs > .
@@ -168,8 +168,8 @@ values, i.e. the direct opposite to L<pairs|/type/List#routine_pairs>.
168
168
169
169
Defined as:
170
170
171
- multi sub join($separator, *@list --> Str:D)
172
- multi method join(List:D: $separator --> Str:D)
171
+ sub join($separator, *@list --> Str:D)
172
+ method join(List:D: $separator --> Str:D)
173
173
174
174
Treats the elements of the list as strings, interleaves them with
175
175
C < $separator > and concatenates everything into a single string.
@@ -186,8 +186,8 @@ Note that the method form does not flatten sublists:
186
186
187
187
Defined as:
188
188
189
- multi sub map(&code, *@elems --> Seq:D)
190
- multi method map(List:D: &code --> Seq:D)
189
+ sub map(&code, *@elems --> Seq:D)
190
+ method map(List:D: &code --> Seq:D)
191
191
192
192
Invokes C < &code > for each element and gathers the return values in a sequence
193
193
and returns it. This happens lazily, i.e. C < &code > is only invoked when the
@@ -263,8 +263,8 @@ invokes L<uc|/type/Str#routine_uc> four times.
263
263
264
264
Defined as:
265
265
266
- multi sub grep(Mu $matcher, *@elems, :$k, :$kv, :$p, :$v --> Seq:D)
267
- multi method grep(List:D: Mu $matcher, :$k, :$kv, :$p, :$v --> Seq:D)
266
+ sub grep(Mu $matcher, *@elems, :$k, :$kv, :$p, :$v --> Seq:D)
267
+ method grep(List:D: Mu $matcher, :$k, :$kv, :$p, :$v --> Seq:D)
268
268
269
269
Returns a sequence of elements against which C < $matcher > smart-matches.
270
270
The elements are returned in the order in which they appear in the original
@@ -305,8 +305,8 @@ Examples:
305
305
306
306
Defined as:
307
307
308
- multi sub first(Mu $matcher, *@elems, :$k, :$kv, :$p, :$end)
309
- multi method first(List:D: Mu $matcher?, :$k, :$kv, :$p, :$end)
308
+ sub first(Mu $matcher, *@elems, :$k, :$kv, :$p, :$end)
309
+ method first(List:D: Mu $matcher?, :$k, :$kv, :$p, :$end)
310
310
311
311
Returns the first item of the list which smart-matches against C < $matcher > ,
312
312
returns Nil when no values match. The optional named parameter C < :end >
@@ -350,7 +350,7 @@ L«C<head>|/routine/head» and L«C<tail>|/routine/tail» methods.
350
350
351
351
Defined as:
352
352
353
- multi method head(List:D: Int(Cool) $number = 1 --> Seq:D)
353
+ method head(List:D: Int(Cool) $number = 1 --> Seq:D)
354
354
355
355
Returns the B < first > NUMBER items of the list. Returns an empty list if
356
356
NUMBER <= 0. Defaults to the first element seen if no NUMBER specified.
@@ -366,7 +366,7 @@ Examples:
366
366
367
367
Defined as:
368
368
369
- multi method tail(List:D: Int(Cool) $number = 1 --> Seq:D)
369
+ method tail(List:D: Int(Cool) $number = 1 --> Seq:D)
370
370
371
371
Returns a L < Seq > containing the B < last > NUMBER items of the list. Returns an empty Seq if
372
372
NUMBER <= 0. Defaults to the last element if no NUMBER is specified.
@@ -384,8 +384,8 @@ say ^Inf .tail # Cannot tail a lazy list
384
384
385
385
Defined as:
386
386
387
- multi sub categorize(&mapper, *@values --> Hash:D)
388
- multi method categorize(List:D: &mapper --> Hash:D)
387
+ sub categorize(&mapper, *@values --> Hash:D)
388
+ method categorize(List:D: &mapper --> Hash:D)
389
389
390
390
Transforms a list of values into a hash representing the categorizations
391
391
of those values according to a mapper; each hash key represents one possible
@@ -411,8 +411,8 @@ Example:
411
411
412
412
Defined as:
413
413
414
- multi sub classify(&mapper, *@values --> Hash:D)
415
- multi method classify(List:D: &mapper --> Hash:D)
414
+ sub classify(&mapper, *@values --> Hash:D)
415
+ method classify(List:D: &mapper --> Hash:D)
416
416
417
417
Transforms a list of values into a hash
418
418
representing the classification of those values according to a mapper;
@@ -432,7 +432,7 @@ Example:
432
432
433
433
Defined as:
434
434
435
- multi method Bool(List:D: --> Bool:D)
435
+ method Bool(List:D: --> Bool:D)
436
436
437
437
Returns C < True > if the list has at least one element, and C < False >
438
438
for the empty list.
@@ -444,7 +444,7 @@ for the empty list.
444
444
445
445
Defined as:
446
446
447
- multi method Str(List:D: --> Str:D)
447
+ method Str(List:D: --> Str:D)
448
448
449
449
Stringifies the elements of the list and joins them with spaces
450
450
(same as C < .join(' ') > ).
@@ -455,7 +455,7 @@ Stringifies the elements of the list and joins them with spaces
455
455
456
456
Defined as:
457
457
458
- multi method Int(List:D: --> Int:D)
458
+ method Int(List:D: --> Int:D)
459
459
460
460
Returns the number of elements in the list (same as C < .elems > ).
461
461
@@ -465,7 +465,7 @@ Returns the number of elements in the list (same as C<.elems>).
465
465
466
466
Defined as:
467
467
468
- multi method Numeric(List:D: --> Int:D)
468
+ method Numeric(List:D: --> Int:D)
469
469
470
470
Returns the number of elements in the list (same as C < .elems > ).
471
471
@@ -506,9 +506,9 @@ against a L<Signature|/type/Signature>.
506
506
507
507
Defined as:
508
508
509
- multi sub pick($count, *@list --> Seq:D)
510
- multi method pick(List:D: $count --> Seq:D)
511
- multi method pick(List:D: --> Mu)
509
+ sub pick($count, *@list --> Seq:D)
510
+ method pick(List:D: $count --> Seq:D)
511
+ method pick(List:D: --> Mu)
512
512
513
513
If C < $count > is supplied: Returns C < $count > elements chosen at random
514
514
and without repetition from the invocant. If C < * > is passed as C < $count > ,
@@ -528,9 +528,9 @@ Examples:
528
528
529
529
Defined as:
530
530
531
- multi sub roll($count, *@list --> Seq:D)
532
- multi method roll(List:D: $count --> Seq:D)
533
- multi method roll(List:D: --> Mu)
531
+ sub roll($count, *@list --> Seq:D)
532
+ method roll(List:D: $count --> Seq:D)
533
+ method roll(List:D: --> Mu)
534
534
535
535
If C < $count > is supplied: Returns a sequence of C < $count > elements, each randomly
536
536
selected from the list. Each random choice is made independently, like a separate
@@ -553,7 +553,7 @@ Examples:
553
553
554
554
Defined as:
555
555
556
- multi method eager(List:D: --> List:D)
556
+ method eager(List:D: --> List:D)
557
557
sub eager(*@elems --> List:D)
558
558
559
559
Evaluates all elements in the list eagerly, and returns them as a list.
@@ -564,8 +564,8 @@ Evaluates all elements in the list eagerly, and returns them as a list.
564
564
565
565
Defined as:
566
566
567
- multi sub reverse(*@list --> List:D)
568
- multi method reverse(List:D: --> List:D)
567
+ sub reverse(*@list --> List:D)
568
+ method reverse(List:D: --> List:D)
569
569
570
570
Returns a list with the same elements in reverse order.
571
571
@@ -581,8 +581,8 @@ Examples:
581
581
582
582
Defined as:
583
583
584
- multi sub rotate(@list, Int:D $n = 1 --> List:D)
585
- multi method rotate(List:D: Int:D $n = 1 --> List:D)
584
+ sub rotate(@list, Int:D $n = 1 --> List:D)
585
+ method rotate(List:D: Int:D $n = 1 --> List:D)
586
586
587
587
Returns the list rotated by C < $n > elements.
588
588
@@ -595,10 +595,10 @@ Examples:
595
595
596
596
Defined as:
597
597
598
- multi sub sort(*@elems --> Seq:D)
599
- multi sub sort(&by, *@elems --> Seq:D)
600
- multi method sort(List:D: --> Seq:D)
601
- multi method sort(List:D: &by --> Seq:D)
598
+ sub sort(*@elems --> Seq:D)
599
+ sub sort(&by, *@elems --> Seq:D)
600
+ method sort(List:D: --> Seq:D)
601
+ method sort(List:D: &by --> Seq:D)
602
602
603
603
Sorts the list, smallest element first. By default C << infix:<cmp> >>
604
604
is used for comparing list elements.
@@ -621,8 +621,8 @@ Examples:
621
621
622
622
Defined as:
623
623
624
- multi sub unique(*@values, :&as, :&with --> Seq:D)
625
- multi method unique(List:D: :&as, :&with --> Seq:D)
624
+ sub unique(*@values, :&as, :&with --> Seq:D)
625
+ method unique(List:D: :&as, :&with --> Seq:D)
626
626
627
627
Returns a sequence of B < unique > values from the invocant/argument list, such
628
628
that only the first occurrence of each duplicated value remains in the
@@ -660,8 +660,8 @@ Example:
660
660
661
661
Defined as:
662
662
663
- multi sub repeated(*@values, :&as, :&with --> Seq:D)
664
- multi method repeated(List:D: :&as, :&with --> Seq:D)
663
+ sub repeated(*@values, :&as, :&with --> Seq:D)
664
+ method repeated(List:D: :&as, :&with --> Seq:D)
665
665
666
666
Returns a sequence of B < repeated > values from the invocant/argument list.
667
667
It takes the same parameters as L < C < unique > > , but instead of passing through
@@ -681,8 +681,8 @@ Examples:
681
681
682
682
Defined as:
683
683
684
- multi sub squish(*@values, :&as --> Seq:D)
685
- multi method squish(List:D: :&as --> Seq:D)
684
+ sub squish(*@values, :&as --> Seq:D)
685
+ method squish(List:D: :&as --> Seq:D)
686
686
687
687
Returns a sequence of values from the invocant/argument list where runs
688
688
of more than one value are replaced with only the first instance.
@@ -704,8 +704,8 @@ temporarily transformed before comparison.
704
704
705
705
Defined as:
706
706
707
- multi sub reduce(&with, *@values)
708
- multi method reduce(List:D: &with)
707
+ sub reduce(&with, *@values)
708
+ method reduce(List:D: &with)
709
709
710
710
Generates a single "combined" value from a list of arbitrarily many of values,
711
711
by iteratively applying a function which knows how to combine I < two > values.
@@ -772,8 +772,8 @@ it is a left fold.
772
772
773
773
Defined as:
774
774
775
- multi sub produce(&with, *@values)
776
- multi method produce(List:D: &with)
775
+ sub produce(&with, *@values)
776
+ method produce(List:D: &with)
777
777
778
778
Generates a list of all intermediate "combined" values along with the final
779
779
result by iteratively applying a function which knows how to combine I < two >
@@ -829,9 +829,9 @@ C<redo> statements inside C<&with>:
829
829
830
830
Defined as:
831
831
832
- multi sub combinations($n, $k --> Seq:D)
833
- multi method combinations(List:D: Int:D $of --> Seq:D)
834
- multi method combinations(List:D: Range:D $of = 0..* --> Seq:D)
832
+ sub combinations($n, $k --> Seq:D)
833
+ method combinations(List:D: Int:D $of --> Seq:D)
834
+ method combinations(List:D: Range:D $of = 0..* --> Seq:D)
835
835
836
836
The C < Int > variant returns all C < $of > -combinations of the invocant list.
837
837
For example
@@ -877,8 +877,8 @@ systems have a limit of C<2³¹-1> and 32-bit systems have a limit of C<2²⁸-1
877
877
878
878
Defined as:
879
879
880
- multi sub permutations($n --> Seq:D)
881
- multi method permutations(List:D: --> Seq:D)
880
+ sub permutations($n --> Seq:D)
881
+ method permutations(List:D: --> Seq:D)
882
882
883
883
Returns all possible permutations of a list as a sequence of lists. So
884
884
@@ -1066,8 +1066,8 @@ post-processing step can then be undertaken.
1066
1066
1067
1067
Defined as:
1068
1068
1069
- multi sub sum($list --> Numeric:D)
1070
- multi method sum(List:D: --> Numeric:D)
1069
+ sub sum($list --> Numeric:D)
1070
+ method sum(List:D: --> Numeric:D)
1071
1071
1072
1072
Returns the sum of all elements in the list or 0 if the list is empty.
1073
1073
Throws an exception if an element can not be coerced into Numeric.
0 commit comments