Calculate n-ary Cartesian Product

后端 未结 6 2145
别跟我提以往
别跟我提以往 2020-12-16 18:03

Given two lists, I can produce a list of all permutations the Cartesian Product of these two lists:

permute :: [a] -> [a] -> [[a]]
per         


        
6条回答
  •  忘掉有多难
    2020-12-16 18:23

    Prelude> sequence [[1,2],[3,4],[5,6]]
    [[1,3,5],[1,3,6],[1,4,5],[1,4,6],[2,3,5],[2,3,6],[2,4,5],[2,4,6]]
    

提交回复
热议问题