Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
IntrusionCM327449dAsync chans event parties are not for everyone.
Hang in there, it takes time.
Learn marble syntax and then try composing the marbles. It'll get a lot clearer.
uyouthe1409049dBecause it’s an entire new concept for you. Classical backgrounds are often C or Lisp, so neither of those learned at basic level come close to rx
galileopy50549dJust think it is a promise that can be resolved multiple times from the same operation.
.then(FN) is .map(FN) where FN returns just a value
.then(pfn) is .flatMap(pfn) where pfn returns a promise/observable
That is as far as I can stretch the simil
.merge "resolves" values from 2 observables into one in the order they appear in the sources observables
.zip is like calling Promise.all each time both sources have new values ( works like array zip, the events are emitted at the pace of the slower observable)
From is like resolve
Subscribe is meant for side effects
.filter discards resolved values just like in an array
And so on
You can get a nice intuition when you learn to use the operators separately.
- the dot operators were removed from rxjs a bit ago for modularity reasons
- flatMap in rxjs is expressed as mergeMap, switchMap, concatMap, etc depending on behavior
- from is mean to be used with generators/things that produce events
- of(val)/of(...series) is for creating Observables from known values
- zip is pairwise in rxjs, not operators
- merge/mergeAll/combineAll/forkJoin are top level in rxjs
- rxjs' filter is lazy, array's monad functions are eager
- Observables resolve once and only once per next without replay/publish behavior
galileopy50548d@SortOfTested Thanks! For some reason I still think in terms of Bacon.js, I gave a shitty explanation. But the gist is the same for me. The hardest part to understand is not how to use the operators, but what does an observable represent.
Is a data structure that allows you to encapsulate sequential events with operators describe how to transform the inner value and functions to set rules on how 2 or more observables interact.
Once you get that, the operators are easy to learn. IMHO.
Yep, just making sure when he went googling he found the dictionary he needed 😊
The only distinction I tend to make is that an observable is a function that allows you to attach a producer to a subscriber. It's a useful distinction because you can you point out that observable never carries any state, which in turn makes explaining hot and cold easier because it allows you to define it as an aspect of the producer.
When I hire people on, part of the 2 weeks on boarding is a crash course in FP as we use RX heavily, as well as Scala and F#. If anyone is actually interested during the training we cover the monad laws using observable.