July 2018
Intermediate to advanced
242 pages
8h 6m
English
To understand the concept of function currying, let's consider the following example of a function handling three parameters:
fun foo(a: A, b: B, c: C): D
Its curried form would look like this:
fun carriedFoo(a: A): (B) -> (C) -> D
In other words, the curried form of the foo function would take a single argument of the A type and return another function of the following type: (B) -> (C) -> D. The returned function is responsible for handling the second argument of the original function and returns another function, which takes the third argument and returns a value of type D.
In the next section, we are going to implement the curried() extension function for the generic functional type declared as follows: ...
Read now
Unlock full access