![]() This is generalisation of a scan operator. The name of this operator stands from multiple-scan. The example above displays a cartesian product for two observables, but in general, the operator can produce products of more than two sources (as N-dimensional product). The result on completion is that all product items have been emitted. This operator combines two sources, and when received item on either of them, emits items that are yet missing for a complete Cartesian product of the two sources. This operator works on observable of characters as input and emits strings on detecting one of string termination markers given This operator re-emits all items in reversed order, at the time of source completion. This operator collects all incoming items and when source completes, re-emits all items in sorted form.Īlternative operator with a user-given binary operator (as item comparer) can be introduced as well. However, dedicated implementation would be so much simpler and smaller, without extra temporary object and buffer constructions etc. ![]() Or could be expressed using the with_index operator introduced above, in the form of: source.with_index().filter(tuple -> tuple.first % N = 0).map(tuple -> cond) This operator provides a very simple way of throttling or sampling observable source items based on a very simple underlying mechanism (a built-in counter will do), so it might be particularly useful for resource-constraint Rx implementations.įunctionality of this operator is equal to chain of: source.buffer(N).map(b->b) This operator takes an integer value N as argument and emits an item from the source every N-1 items, skipping all others in between. Operator that groups most recent N (and exactly N) items into a tuple (or buffer). The operator is inspired with Python’s enumerate function that iterates over collection and returns pair of an index and a value. Similar to timestamp except that is attaches an ordinal information to each emitted item. Others - are proposed for clarity and convenience because they introduce better semantics than alternative of not-so-obvious compositions. Some of them offer functionality that cannot be easily created by a simple composition of existing operators. The candidates seem so far not to be part of any major or popular Rx library (as documented on ) but IMO would be useful as part of such. I’ve decided to share the idea of introducing few new general-purpose reactive operators and observables. Since some time, reactive programming is one of my favourite field of modern software engineering.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |