title: F# permutations
body: <p>I need to generate permutations on a given list. I managed to do it like this</p>
  
  <pre><code>let rec Permute (final, arr) = 
      if List.length arr &gt; 0 then
          for x in arr do
              let n_final = final @ [x]
              let rest = arr |&gt; List.filter (fun a -&gt; not (x = a))
              Permute (n_final, rest)
      else
          printfn "%A" final
  
  let DoPermute lst  = 
      Permute ([], lst)
  
  DoPermute lst
  </code></pre>
  
  <p>There are obvious issues with this code. For example, list elements must be unique. Also, this is more-less a same approach that I would use when generating straight forward implementation in any other language. Is there any better way to implement this in F#.</p>
  
  <p>Thanks!</p>