I've recently started learning F#. I'm attempting to loop through a list of functions, applying each function to a value. For example, I have:
let identity x = fun x -> x
let square x = fun x -> x * x
let cube x = fun x -> x * x * x
let functions = [identity; square; cube]
I would now like to do something like the following:
let resultList = List.map(fun elem -> elem 3) functions
where the result value would be the list [3;9;27]. However, this is not what happens. Instead, I get:
val resultList : (int -> int) list = [<fun:Invoke@3000>; <fun:Invoke@3000>; <fun:Invoke@3000>]
I guess I'm not entirely convinced that using map is the right way forward any longer, so my questions are:
- Why do I not get a list of numbers?
- How would return a list of numbers?
- What does
<fun:Invoke>mean?
Thanks very much for your help.
Daniel