I have a function that works fine for lists however the input to the function comes as float[,]
from external system / language.
I read this but when I apply this I get an error float[,] is not compatible with Seq<a'>
. However this list is also only of floats.
List function:
let aggrArraysL data =
data
|> Seq.groupBy (fun (a, b, c) -> a)
|> Seq.map (fun (key, group) ->
group |> Seq.reduce (fun (a, b, c) (x, y, z) -> a, b + y, (b * c + y * z * 1.)/(b + y)))
Array attempt:
let aggrArrays (data2 : float[,]) =
data2
|> Seq.toList
|> Seq.groupBy (fun (a, b, c) -> a)
|> Seq.map (fun (key, group) ->
group |> Seq.reduce (fun (a, b, c) (x, y, z) -> a, b + y, (b * c + y * z * 1.)/(b + y)))
|> Seq.toArray
Where am I going wrong? thanks!