O'Reilly logo

Real-World Functional Programming with Examples in F# and C# by Jon Skeet, Tomas Petricek

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required