title: Using multiple generic types in lambda in kotlin
body: <pre><code>Koltin 1.2.30
  </code></pre>
  
  <p>I am working with generic and lambda functions.</p>
  
  <p>The following works without the generic types</p>
  
  <pre><code>fun onScanExt(): (Int, Int) -&gt; Int = {
      num1, num2 -&gt; num1 + num2
  
      num1 + num2
  }
  </code></pre>
  
  <p>However, with the generics:</p>
  
  <pre><code>fun &lt;T, R&gt; onScanExt(): (T, T) -&gt; R = {
      num1, num2 -&gt; num1 + num2
  
      num1 + num2
  }
  </code></pre>
  
  <p>I guess the above cannot work as the generic type might not be a Number type and someone could pass in a String and the lambda wouldn't know what to do with a String type if there is a calculation involved.</p>
  
  <p>Any suggestions of example on how to pass in multiple generics and return a generic type?</p>
  
  <p>Many thanks in advance,</p>