September 2018
Intermediate to advanced
398 pages
9h 43m
English
Before we start currying functions, we need to understand the difference between a function and a function value.
You are already familiar with functions—they begin with the keyword def, take one or several parameter lists between () symbols, optionally declare a return type after a : sign, and have a defined body after the = sign, as shown in the following example:
def multiply(x: Int, y: Int): Int = x * y// multiply: multiply[](val x: Int,val y: Int) => Int
A function value (also called a function literal) is similar to any other value, such as "hello": String, 3: Int, or true: Boolean. As with other values, you can pass a function value as an argument to a function, or assign it to a variable using the val keyword.
You can ...
Read now
Unlock full access