Passing a lambda function to another function works like this:
Suppose we have a trivial function of our own as follows:
let functionThatTakesaFunctionAndAList f l = List.map f l
Now you can pass a lambda function and a list to it:
functionThatTakesaFunctionAndAList (fun x -> x ** 3.0) [1.0;2.0;3.0]
Inside our own function functionThatTakesaFunctionAndAList
you can just refer to the lambda function as f
because you called your first parameter f
.
The result of the function call is of course:
float list = [1.0; 8.0; 27.0]