Chapter 5. Using functional values locally
This chapter covers
- Understanding the role of values
- Representing values with discriminated unions
- Using generic types and type inference
- Creating functions using lambda syntax
This chapter is about values. It’s a term that’s used a lot in different programming languages, so we ought to first define what we mean. When we discuss the concepts of functional programming, we describe functional programs as a computation that takes inputs and returns a result. In simple terms, a value is what you can use as input or receive as a result. This means that everything you’ll work with inside the computations you implement is a value.
When writing a function that performs a calculation, we can give it all ...