permutation method, when called with a block yields a two dimensional array consisting of all ordered sequences of a collection of numbers.
If this method is called without a block, it will return an
enumerator. To convert to an array, call the
combination method on the other hand, when called with a block yields a two-dimensional array consisting of all sequences of a collection of numbers. Unlike permutation, order is disregarded in combinations. For example,
[1,2,3] is the same as
Calling the combination method by itself will result in an enumerator. To get an array, call the
repeated_permutation methods are similar, except the same element can be repeated multiple times.
For example the sequences
[3,3,3] would not be valid in regular combinations and permutations.