I think I understand the difference between permutation and combination:
array = [1,20,30,40,50,60]
1.upto(array.length).each do |combination_length|
array.combination(combination_length).each do |combination|
# ... do something here with the combination ...
"What I'm specifically trying to do is run a block for each element of the array.combination results, but I don't want to load up all the length-N combinations into memory first."
That is exactly what your code is doing. You are invoking the
combination method without a block, which results in an Enumerator. Then you use its
eachmethod. Only one combination is in memory at a time.