Get all permutations of a list in Haskell

后端 未结 8 1167
一整个雨季
一整个雨季 2020-12-15 17:34

I\'m trying to do this from scratch, without the use of a library outside the standard lib. Heres my code:

permutations :: [a] -> [[a]]
permutations (x:xs         


        
8条回答
  •  醉酒成梦
    2020-12-15 17:49

    It's already in the standard base library, so no need to struggle. If you really want to see how to do it, you can look at the source of that library.

提交回复
热议问题