title: How is this power set generating function working
body: <p>While trying to generate power set for a given list, I came across this function over the internet. There was no explanation, but testing suggests that it seems to work correctly. I am not able to understand how this function is working. I will be thankful for any such explanations.</p>
  
  <pre><code>generateSubset [] = [[]]
  generateSubset (x:xs) = let p = generateSubset xs in p ++ map (x:) p
  </code></pre>