3 ms·
I dunno about "deep" - it's literally available in the Ruby stdlib: http://ruby-doc.org/core-2.4.0/Array.html#method-i-combination http://ruby-doc.org/core-2.4
by al2o3cr 10y ago
I dunno about "deep" - it's literally available in the Ruby stdlib:
http://ruby-doc.org/core-2.4.0/Array.html#method-i-combination http://ruby-doc.org/core-2.4.0/Array.html#method-i-combinati...
There's also `repeated_combination` (if elements can be used more than once) and you can even add `.lazy` on the end to avoid building the entire array of combinations if you're only interested in some.
- josephorjoe 10y ago<3 ruby -- I hope they add a `.fizzbuzz` method to the enumerable module in the next release.