title: How to store closures in a Swift array
body: <p>I would like to store closures in an array. But I have no clue how to do it, or my thinking is totally wrong. With setup shown below I got an error:</p>
  
  <pre><code>Cannot convert value of type '(Reader) -&gt; (URL) -&gt; ()' to expected element type '(URL) -&gt; ()'
  </code></pre>
  
  <p>I don't understand it. My class:</p>
  
  <pre><code>class Reader {
      let fileNamesActions:[( filename:String, action:(URL) -&gt; () )]  = [
          (filename:"goodStories.txt", action: readGoodStories),
          (filename:"badStories.txt", action: readBadStories),
          (filename:"stupidStories", action: readStupidStories)]
  </code></pre>
  
  <p>I have declared functions like this:</p>
  
  <pre><code>    func readGoodStories(from url:URL) {
          //read, do whatever i want with url
      }
      ...
  </code></pre>
  
  <p>And I call them by: </p>
  
  <pre><code>    init (with url:URL) {    
           for (filename, action) in fileNamesActions {
               action(url.appendingPathComponent(filename))
           }
       }
  </code></pre>