I know how to use list comprehension to do this, but how can I implement a function that will recursively compute the cartesian product given two sets?
Here's where I'm stuck (and I'm a noob)
crossProd :: [Int] -> [Int] -> [(Int,Int)]
crossProd xs ys | xs == [] || ys == [] = []
| otherwise = (head xs, head ys) : crossProd (tail xs) (ys)
The output of this gives me
[(1,4),(1,5),(1,6)]
If the sets are [1,2,3]
and [4,5,6]
respectively..
How would I go about getting the rest?