title: Curry Function in Swift
body: <p>I want to make a function that return a curry function like below</p>
  
  <pre><code>func addTwoNumbers(a: Int)(b: Int) -&gt; Int {
      return a + b
  }
  
  addTwoNumbers(4)(b: 6) // Result: 10
  
  var add4 = addTwoNumbers(4)
  add4(b: 10) // returns 14     
  </code></pre>
  
  <p>What is the return type of such function and how can I generate a function like this using a function that take Variadic parameters.</p>
  
  <pre><code>func generateCurry(.../*Variadic parameters*/) -&gt; .../*curry function type*/ {
    return ...//curry function
  }
  </code></pre>
  
  <p>I want a generic solution and not take only Int as arguments in the parmeter of the generateCurry function</p>
  
  <pre><code>let curried = curry(func(a, b, c) {
    print(a + b + c)
  })
  curried(1)(2)(3) //prints 6
  </code></pre>