refactored to use clojure.math/combinatorics to create a cartesian product of partial functions