title: Map function in MATLAB?
body: <p>I'm a little surprised that MATLAB doesn't have a Map function, so I hacked one together myself since it's something I can't live without.  Is there a better version out there?  Is there a somewhat-standard functional programming library for MATLAB out there that I'm missing?</p>
  
  <pre class="lang-none prettyprint-override"><code>function results = map(f,list)
  % why doesn't MATLAB have a Map function?
  results = zeros(1,length(list));
  for k = 1:length(list)
      results(1,k) = f(list(k));
  end
  
  end
  </code></pre>
  
  <p>usage would be e.g.</p>
  
  <pre><code>map( @(x)x^2,1:10)
  </code></pre>