Neater implementation of combinations using foldRight, and no need for filtering anymore.