title: Python, recursively reduce a list (combinations/permutations)
body: <p>I'm trying to make a generic function that would reduce a list like so :</p>
  
  <pre><code>func(['a','b','c'],str.join) # --&gt; ['a','b','c','ab','ac','bc','abc']
  
  func(['a','b','c'],lambda: a,b:a+'x'+b) # --&gt; ['a','b','c','axb','axc','bxc','axbxc']
  </code></pre>
  
  <p>I don't really know how to do it. I did a few tries, but none was successful. 
  I'm pretty sure there is a way to do it with reduce but i'm not very comfortable with the use of this function. Here are some attempts :</p>
  
  <pre><code>reduce(lambda a,b:[a,b,str(a)+str(b)],['a','b','c'])
  
  reduce(str.join,['a','b','c'])
  </code></pre>
  
  <p>I think i'm missing a recursion somewhere.</p>
  
  <p>I'm not asking for code especially, any help or advice is welcomed. Thanks.</p>