I'm working with F# and I struggle building my business model.
Let's say I have a list of float and two types of transformations I can apply on it.
By example:
type Transformation =
| SMA of period:Period
| P2MA of period:Period
Then I have defined a function let compute Transformation list
to compute any kind of transformation over a list.
With the above Transformation type, I can create a SMA(3) or a P2SMA(5) by example.
I would like to be able to nest the transformations in a way I can write SMA(3, P2SMA(5, SMA(10))) by example. But also I would like to still be able to write SMA(2) only.
I tried using options, but I think writing SMA(3, None) or SMA(3, Some(P2SMA(5))) is too verbose.
Is there any way to do that? Maybe my approach is wrong, as I'm new in F#, I may tackle the problem by the wrong way?
Thanks a lot for the help
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…