I have a function in Haskell that given a list, returns some of its permutations.
My problem is that I have to give the length of the list in order for the function to work. Is there any way to change that using let or where?
generate_permutations list 0 = my_permutation 1 4 list
generate_permutations list n = list (my_permutation (list!!n) 4 list) ++ generate_permutations list (n-1)
I want to initialize n with length of the list.
- I don't know how to do it.
- If I manage to do it how can I stop the recursion?