With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

No credit card required

One Bound, Two to Go

Through currying, Scala allows methods to be defined with multiple parameter lists. Consider the following two method definitions:

```  def regular(x: Int, y: Int, z: Int) = x + y + z
def curried(x: Int)(y: Int)(z: Int) = x + y + z
```

Both methods compute the same result when given identical values for their corresponding arguments:

```  scala> regular(1, 2, 3)
res0: Int = 6
scala> curried(1)(2)(3)
res1: Int = 6
```

Despite this similarity, the curried method is fundamentally different from the regular one: the invocation of curried represents three consecutive function invocations.[1]

Scala also supports default arguments, which significantly reduces the need for method overloading. Furthermore, by combining default arguments ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

No credit card required