title: Derive every possible combination of elements in array
body: <p>Given an array and a length, I want to derive every possible combination of elements (non-repeating) at the specific length.</p>
  
  <p>So given an array of:</p>
  
  <pre><code>arr = ['a','b','c','d']
  </code></pre>
  
  <p>and a length of 3, I'm after a function that outputs a 2-dimensional array as follows:</p>
  
  <pre><code>result = [
      ['a','b','c'],
      ['b','c','a'],
      ['c','a','b'],
      . . . etc.
  ]
  </code></pre>
  
  <p>I've tried tackling this and have had a deal of difficulty.</p>