I am trying to generate all possible combinations of n numbers. For example if n = 3 I would want the following combinations:
(0,0,0), (0,0,1), (0,0,2)... (0,0,9
combos 1 list = map (\x -> [x]) list combos n list = foldl (++) [] $ map (\x -> map (\y -> x:y) nxt) list where nxt = combos (n-1) list
In your case
combos 3 [0..9]