- :integer
- :block
combine
get all possible combinations of the elements in given collection
Parameters
combine collection :block
Attributes
by | :integer | define size of each set |
repeated | allow for combinations with repeated elements | |
count | just count the number of combinations |
Returns
Examples
copycombine [A B C] ; => [[A B C]] combine.repeated [A B C] ; => [[A A A] [A A B] [A A C] [A B B] [A B C] [A C C] [B B B] [B B C] [B C C] [C C C]]
copycombine.by:2 [A B C] ; => [[A B] [A C] [B C]] combine.repeated.by:2 [A B C] ; => [[A A] [A B] [A C] [B B] [B C] [C C]]
copycombine.count [A B C] ; => 1 combine.count.repeated.by:2 [A B C] ; => 6