- Scala Design Patterns.
- Ivan Nikolov
- 66字
- 2021-08-27 19:09:50
Partial functions
Mathematics and functional programming are really close together. As a consequence, some functions exist that are only defined for a subset of all the possible input values they can get. A popular example is the square root function, which only works for non-negative numbers. In Scala, such functions can be used to efficiently perform multiple operations at the same time or to compose functions.