Reactive Extensions API in depth: CombineLatest

Sign in to queue

Description

In this episode of the Rx API in depth, Wes talks about the CombineLatest operator and it's relation to the Zip operator

Visit the Reactive Extensions DevLabs page to download and learn more about Rx.

Embed

Download

Download this episode

The Discussion

  • User profile image
    staceyw

    Thank you.  Could you please add Senerios for usage in the videos?  It can help understand why one would use an operator.

  • User profile image
    J.Van.Gogh

    Definately, we already have the videos for the upcoming week or so recorded, but we'll include that in the next batch we'll record..

     

    CombineLatest is extremely useful in a scenario where you always need a pair of events e.g. you need to know the latest key pressed in combination of the latest position of the mouse cursor.

  • User profile image
    exoteric

    Then also amp up the volume please, it's very very low; I thought this was a passing issue while Charles was at the PDC. Going from this to a RiSE video you hear the extremely loud logo music pumping out in the speakers (pretty late here).

     

    Still, good series you have here. It's kind of an interesting concept. One video per method, you can almost make video-intellisense with that. It would be cool to have these marble diagrams in the MSDN documentation.

  • User profile image
    J.Van.Gogh

    Yup aware of the volume (and lighting) issues, recording on a Flip right now, which is great for home videos but less ideal for these kind of videos, getting a more professional camera soon...

     

    Thanks! Yes we'll definately bring the marble diagrams up with the doc team...

  • User profile image
    aL_

    combine latest is really great if you have streams that operate at diffrent speeds or if you want to aggregate streams Smiley

     

    maybe you have a stock ticker with currency conversion that keeps track of the exchangerates in real time, your app gets told when a stock changes and also when the exchange rate changes, so when either of those events occur you want to change the value the user sees. but maybe the market fluctuates alot but the exchange rate is stable, then zip would produce values that have already become obsolete, but combineLatest would not Smiley

     

    another example is like if you have a robot with sensors that measure vertical and horizontal position, and you have code that keeps the robot from falling over, neither sensor is aware of the other and they produce values independently. Yet if one of them changes, the x/y position of the robot has changed and the code needs to be made aware so it can compensate.

     

    zip is similar but a little diffrent. maybe you have a speed dating website where people register and you have one stream for men and one for women and when a new person registers, you want to remember who the last person of the opposite sex who registered was but also make sure that that person is not on a date already and you also make sure that no one who registers is left without a date if one is available. thats what zip will do for you Smiley

  • User profile image
    Thierry

    Is slight hesitation at 1:05 revealing a wrong naming convention ?

     

    Perhaps CombineLatest should be renamed ZipLatest.

  • User profile image
    exoteric

    Maybe a little video post-processing filter will do the trick.

     

    Looking forward to the "pi" combinators.

  • User profile image
    Zahir Tezcan

    Is there any option to be as fast as the slowest stream for streams with different frequencies?

    eg.

     

    for streams

     

    ---x---y---z---t---u--->

    -a-b-c-d-e-f-g-h-i-j-->

    ---o---o---o--o---o-->

    f(a,x)

    f(c,y)

    f(e,z)

    f(g,t)

    f(i,u)

     

    which is to invoke combination when both streams has a 'new' output. This may incur new problems such that observers may want to infer intermediate values for grouping like interpolations.

Add Your 2 Cents