What is a good way of iterating over N dimensions in F#? Specifically I want to iterate the levels in a list of lists and display the different paths. Here's a trivial example of what I would like to do in arbitrary list dimensions.
let L1 = ["A"; "B"]
let L2 = ["C"; "D"]
let L3 = ["E"; "F"; "G"]
let pathSteps = [L1; L2; L3]
let printAllPaths =
let allPaths =
seq{
for c1 in L1 do
for c2 in L2 do
for c3 in L3 do
yield [c1; c2; c3]
}
for ls in allPaths do
ls
|> Seq.toList
|> printfn "%A"