File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -874,6 +874,23 @@ L«C<List.classify>|/type/List#routine_classify» on it.
874
874
875
875
= head2 method produce
876
876
877
+ Defined as:
878
+
879
+ multi method produce(Any:U: & --> Nil)
880
+ multi method produce(Any:D: &with)
881
+ multi sub produce (&with, +list)
882
+
883
+ This is similar to L < C < reduce > |/routine/reduce#(List)_routine_reduce> , but
884
+ returns a list with the accumulated values instead of a single result.
885
+
886
+ = for code
887
+ <10 5 3>.reduce( &[*] ).say ; # OUTPUT: «150»
888
+ <10 5 3>.produce( &[*] ).say; # OUTPUT: «(10 50 150)»
889
+
890
+ The last element of the produced list would be the output produced by the
891
+ C < .reduce > method.
892
+
893
+ If it's a class, it will simply return Nil.
877
894
878
895
= head2 method pairs
879
896
You can’t perform that action at this time.
0 commit comments