FP examples
The only thing that sets FP aside from other methods of programming is that functions do not modify data or state. You will use FP in scenarios such as deep learning (DL), machine learning (ML), and artificial intelligence (AI) when it is necessary to perform different sets of operations on the same set of data.
The LINQ syntax within .NET Framework is an example of FP. So, if you are wondering what FP looks like, and if you have used LINQ before, then you have been subjected to FP and should know what it looks like.
Since FP is a deep subject and many books, courses, and videos exist on this topic, we will only touch on the topic briefly in this chapter by looking at pure functions and immutable data.
A pure function is restricted to only operating on the data that is passed into it. As a result, the method is predictable and avoids producing side effects. This benefits programmers because such methods are easier to reason about and test.
Once an immutable...