Partial functions
In mathematics, and as a consequence in programming, there are functions that are not defined for all possible inputs. A simple example will be the square root function—it will only work for real numbers if they are non-negative. In this section, we will look at partial functions and how we can use them.
Partial functions are not partially applied functions
There seems to be some confusion around what partial functions are and what they are not. It is important for you to understand that these functions are not partially applied functions. Partially applied functions are simply functions that might take multiple parameters and we've specified some of them and then they return functions with fewer parameters that we can specify. There is another term—curried functions—that is related to partially applied functions. In terms of functionality, they provide the same functionality. Let's see a quick example:
/** * Note that these are not partially defined functions! */ object...