ReactiveBayes/Rocket.jl

Add optional seed argument to `pairwise` operator.

Closed this issue · 4 comments

Hi,

just learning about reactive programming and this repo is great!

I am using the pairwise operator to pair up elements of an observable. However, this means that I need to wait for two elements to be available for the first output element to be emitted. Elements 1, 2, 3, 4, ... would be paired as (1, 2), (3, 4), ...

Would it be possible to add a seed optional argument to pairwise, to be use as a fictitious element number one? This would pair elements as (seed, 1), (2, 3), (4, 5), ...

Hi @gasagna,

Thank for your feedback. There is a start_with operator for these purposes. Can you try it as:

source |> start_with(seed) |> pairwise()

Hi @bvdmitri,

this does the job, thanks! You can close the issue, unless this is a feature that you want to add at some point and can be tracked with this issue.

For me it seems like a nice feature to have and it should be easy to implement.
I will add optional initial value to |> pairwise() operator in next minor release.

This feature is now available in v1.3.9 version!