In ReactiveX I can take the latest value out of each of a number of observables, which each may or may not be emitting at different frequencies, as follows (using RxPY):
from __future__ import print_function
from rx import Observable
import time
import IPython
import random
random.seed(123)
x1 = Observable.interval(random.randint(50, 500))
x2 = Observable.interval(random.randint(50, 500))
x3 = Observable.interval(random.randint(50, 500))
xc = Observable.combine_latest(x1, x2, x3, lambda a1, a2, a3: [a1, a2, a3])
xc.subscribe(lambda s: print(s))
input("Press Enter to end")
However, how would I do the same thing, that is, print the latest value from each of a set of observables, whenever any of the observables emits a value, when said observables were created using a group_by?
from __future__ import print_function
from rx import Observable
import time
import IPython
import random
random.seed(123)
n = 5
xx = Observable.interval(random.randint(50, 500)).group_by(lambda x: x % 5) # create n observables
print(xx)
Thing is this returns an observable group object:
<rx.core.anonymousobservable.AnonymousObservable object at 0xb631bb10>
So for any given n how would I perform the same combine_latest operation on this object?
I understand that in this stylized example the observables will emit at the same rate, but I need the solution to generalize to different emission frequencies as per the explicit example at the top.
Given that the structure of RxPY and RxJS are so similar, I am happy to consider analogous RxJS answers.