title: Which algorithm should I use to extract an array from a multidimensional array?
body: <p>For example, I'd want to extract sub-arrays from an array like this, where <code>arr</code> is a 3-dimensional array, and <code>"all"</code> means that all possible values at that index position are selected:</p>
  
  <p><code>getSubArray(arr, ["all","all",1])</code> returns a 2-dimensional slice of arr, with the indices from <code>arr</code> being <code>["all", "all", 1]</code>.</p>
  
  <p><code>getSubArray(arr,["all",2,2])</code> should return a 1-dimensional array from <code>arr</code>, with the indices from <code>arr</code> being <code>["all", 2, 2]</code>.</p>