Basically I have a list of methods that I want to iterate through, call the methods, and return the list of method return values. I can get it working with Linq syntax.
member public x.TakeIn(methodList : seq<(String -> Int32)>, input:String) =
methodList.Select((fun (item:String -> Int32) -> item(input))).ToList()
However I can’t get map too work which I’m guessing is my lack of F# syntax knowledge.
member public x.TakeIn(methodList : seq<(String -> Int32)>, input:String) =
methodList |> List.map (fun (item) -> item(input))
Shouldn’t that imply that the map method will take in a seq<(String -> Int32)>, iterate through, call each method, and return a list of Int32?
Because
methodListis a sequence in F#, you can’t treat it as a list (which is one of its subtypes). So make sure that you use high-order functions for the sequence and convert the result to a list: