In F#, how do you handle (float seq) and { ts : DateTime; value: float } in a generic manner?

coding-style, f#

Solution

Just convert the timestamped seq into a float seq like this:

xs
|> Seq.map (fun x -> x.value)

Problem

What is the best way to write your functions so they can handle seamlessly: - a float seq - a timestamped series of the type { ts : DateTime; value: float } seq, where the values are in the float called value I need in particular to write functions such as computing the average/variance/random transformations of the time series, and I would like to write only 1 version of these functions.

Original source

Related problems