Passing a closure as argument in a recursive function in Swift
<p>I'm trying to implement the map function in Swift. But I'm stuck with an error</p>

<blockquote>
  <p>at map(<strong>f</strong>, ...): Cannot convert value of type 'T -> U' to expected argument type '_ -> _' </p>
</blockquote>

<pre><code>func map&lt;T, U&gt;(f: T -&gt; U, _ list: [T]) -&gt; [U] {
    return list.isEmpty ? [] : [f(list.first!)] + map(f, list[1..&lt;list.count])
}
</code></pre>