Press "Enter" to skip to content

Currying in Scala

Sarfaraz Hussain takes us through one of the most important concepts in functional languages:

Normally we write function and it seems like below:

def multiplySimple(a: Int, b: Int): Int = a * b

We declare a function with all the arguments needed inside a single parameter list.

In currying however, we can split this parameter list into multiple parameter lists.

def multiplyCurry(a: Int)(b: Int): Int = a * b

This doesn’t seem like much, but it does lead to partial application of functions and is one method for how we can have multiple inputs in a functional programming language when mathematical functions allow one input.