1

Is there a more efficient way to generate the cross join or permutations for the combination of elements in two lists of arbitrary lengths, in f#?

listA
|> Seq.collect (fun a -> listB |> Seq.map (fun b -> a,b))

Where...

listA = [1;2]
listB = ['a';'b']
Result = [(1,'a');(1,'b');(2,'a');(2,'b')]
George
  • 2,451
  • 27
  • 37
  • 1
    Using `List.collect` and `List.map` is more efficient than using sequences and then converting back to list. Specially when the lists are not too large. – Gus Feb 28 '15 at 07:20

0 Answers0