Hello,
In simple words, I want to implement a function like that:
let myfunction (scalar : float) (quantities : ''T list) =
List.fold (fun acc quantity -> acc + quantity * scalar)
LanguagePrimitives.GenericZero<_>
quantities : 'T
Note that I am multiplying a value of generic type 'T
and a float value (quantity * scalar
) which should return a value of type 'T
. For example, multiplying a Point
by a scalar result in a Point
.
I cannot make F# understand that the multiplication quantity * scalar
should result in a value of type 'T
. I tried LanguagePrimitives.MultiplyDynamic
, but it seems that this function is reserved to be used by the F# compiler.
What should I do?