@@ -586,7 +586,8 @@ array values. (Note: When used on actual sets and other iterable
586
586
structures, specialized versions of this method are allowed to bypass
587
587
turning it into a list first. Also, the return values are allowed
588
588
to be specialized to any non-flattening container, so that subsets
589
- of sets can actually be a set of sets.)
589
+ of sets can actually be a set of sets. If the ordering of the input
590
+ doesn't matter, neither does the ordering of the subsets.)
590
591
591
592
It is erroneous to ask for the combinations of any infinite list.
592
593
The compiler is allowed to complain if it notices, however.
@@ -1113,6 +1114,24 @@ Works like an ordinary list C<pick>.
1113
1114
1114
1115
Works like an ordinary list C<roll>.
1115
1116
1117
+ =item combinations
1118
+
1119
+ multi method combinations ( Int $of )
1120
+ multi method combinations ( Range $of = 1 .. +self )
1121
+
1122
+ Works as if the set were turned into a list of elements and then
1123
+ the combinations were turned back into a list of sets, ordered by
1124
+ increasing size. You may, of course, turn that list back into a set of sets.
1125
+
1126
+ Note that, without an argument, this method does not quite calculate
1127
+ the powerset; you must add in the null set to get that, as below.
1128
+
1129
+ =item powerset
1130
+
1131
+ multi method powerset { set ∅, self.combinations }
1132
+
1133
+ Defined as above.
1134
+
1116
1135
=back
1117
1136
1118
1137
=head2 KeySet
0 commit comments