title: Differences between these three ways of defining a function in Scala
body: <p>Given three ways of expressing the same function <code>f(a) := a + 1</code>:</p>
  
  <pre><code>val f1 = (a:Int) =&gt; a + 1
  def f2 = (a:Int) =&gt; a + 1
  def f3:(Int =&gt; Int) = a =&gt; a + 1
  </code></pre>
  
  <p>How do these definitions differ?  The REPL does not indicate any obvious differences:</p>
  
  <pre><code>scala&gt; f1
  res38: (Int) =&gt; Int = &lt;function1&gt;
  scala&gt; f2
  res39: (Int) =&gt; Int = &lt;function1&gt;
  scala&gt; f3
  res40: (Int) =&gt; Int = &lt;function1&gt;
  </code></pre>