Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add reduce operator, from_iterable sends its elements in one single b…
…atch, add optimal control example
- Loading branch information
1 parent
4dadfd2
commit 8950e4b
Showing
51 changed files
with
1,493 additions
and
467 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
""" | ||
This example demonstrates the use-case of the share operator defined | ||
on MultiCast objects. | ||
""" | ||
|
||
import rxbp | ||
from rxbp.multicast.multicast import MultiCast | ||
|
||
|
||
def connect_and_zip(multicast: MultiCast): | ||
return rxbp.multicast.collect_flowables( | ||
multicast, | ||
multicast, | ||
).pipe( | ||
rxbp.multicast.op.map(lambda t: t[0].zip(t[1])) | ||
) | ||
|
||
|
||
def merge_and_reduce(multicast: MultiCast): | ||
return rxbp.multicast.merge( | ||
multicast, | ||
multicast, | ||
).pipe( | ||
rxbp.multicast.op.reduce_flowable(), | ||
) | ||
|
||
|
||
result = rxbp.multicast.from_flowable(rxbp.range(10)).pipe( | ||
rxbp.multicast.op.share(connect_and_zip), | ||
rxbp.multicast.op.share(merge_and_reduce), | ||
).to_flowable().run() | ||
|
||
print(result) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.