What is the proper way to extend the available operators when using RX?
I’d like to build out some operations that I think would be useful.
The first operation is simply the standard deviation of a series.
The second operation is the nth lagged value i.e. if we are lagging 2 and our series is A B C D E F when F is pushed the lag would be D when A is pushed the lag would be null/empty when B is pushed the lag would be null/empty when C is pushed the Lag would be A
Would it make sense to base these types of operators off of the built-ins from rx.codeplex.com or is there an easier way?
In idiomatic Rx, arbitrary delays can be composed by
Zip.As for a rolling buffer, the most efficient way is to simply use a
Queue/ResizeArrayof fixed size.For
numbers |> rollingBuffer 3 |> log:For pairing adjacent values, you can just use
Observable.pairwiseObservable.Scanis more concise if you want to apply a rolling calculation .