What is the shortest way of getting all K-item combinations of an N-item array where K <= N? I managed to write down the one below :
> [1,2,3].instance_eval "(1..size).flat_map {|i| self.combination(i).to_a }"
=> [[1], [2], [3], [1, 2], [1, 3], [2, 3], [1, 2, 3]]
Any ideas how to get rid of "instance_eval"? It doesn't seem to be very elagant :\