I was just watching lecture 2.2 Higher order functions (for the Functional programming principles in Scala). There, a sum function is defined like this:
def sum(f: Int => Int, a: Int, b: Int) { ... }
Later on, the same function is defined like this:
def sum(f: Int => Int)(a: Int, b: Int) { ... }
They seem to be equivalent, but no explanation is given why to choose on over the over.
The second definition declares a method with two argument lists. Ignoring implicits, then this is usually used to enable curried function applications. The basic idea is that you can bind some parameters of a function, which yields another function with fewer arguments left, namely the ones that are not yet bound. Here is a simple text book example:
You’ll find plenty of articles about currying online, for example, how to use currying in Scala, or that there are multiple ways to curry in Scala.
Regarding why to choose one over the over: In Haskell you would basically always choose the curried version over the uncurried one since the latter gives you the advantage of being able to partially bind parameters, and since there is no “syntax penalty” or runtime penalty for using curried versions. Since this is not true for Scala (as you can observe from the above code snippet when it comes to syntax), you might probably want to prefer the uncurried style except if you know that the most likely use cases of your methods/functions would benefit from currying.