concept transformation in category .net

This is an excerpt from Manning's book Concurrency in .NET.
FP is about minimizing and controlling side effects, commonly referred to as pure functional programming. FP uses the concept of transformation, where a function creates a copy of a value x and then modifies the copy, leaving the original value x unchanged and free to be used by other parts of the program. It encourages considering whether mutability and side effects are necessary when designing the program. FP allows mutability and side effects, but in a strategic and explicit manner, isolating this area from the rest of the code by utilizing methods to encapsulate them.
Listing 3.13 Representation of a list in F# using discriminated unions
type FList<'a> = | Empty #1 | Cons of head:'a * tail:FList<'a> #2 let rec map f (list:FList<'a>) = #3 match list with | Empty -> Empty | Cons(hd,tl) -> Cons(f hd, map f tl) let rec filter p (list:FList<'a>) = match list with | Empty -> Empty | Cons(hd,tl) when p hd = true -> Cons(hd, filter p tl) | Cons(hd,tl) -> filter p tl #1 Empty case #2 Cons case has the head element and the tail #3 Recursive function that traverses a list using pattern matching to deconstruct and performs a transformation on each item
This function has two arguments. The first is a
Task<TInput>that evaluates to an expression. The result is passed into the second argument, aFunc<TInput, TResult>delegate, to apply a transformation and then return the final value.