I have the following function:
let fetchTickerGroup (tickers: string[]) (sqlServer:SQLServerClient) (schema: string) =
tickers |> Array.map(fun x -> sqlServer.FetchTimeSerie(schema,x))
The function takes an array of strings and, through sqlServer fetches data which is returned by sqlServer.FetchTimeSerie as a List<b> where b is a custom defined object.
Now, mapping the array means that the function fetchTickerGroup returns List<b>[].
I was wondering if it would be possible to flatMap the result, rather than just mapping the array values.
I have no Idea what Flatmap is but I think you want to use *.collect.
I think the best solution would be something like
tickers |> Array.toList |> List.collect (fun x -> sqlServer.FetchTimeSerie(schema,x))
you need to convert so that you have only list or array types
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With