Comments (5)
I don't quite understand the problem.
RxRule is having a Scheduler that will run. The essential part is that subscribe is called eagerly. Which is asserted with assertEmpty()
& assertThat(subscribeCounter.get()).isEqualTo(2) // We want to subscribe immediately.
from rxriddles.
I'm going to close this for now as I don't see a reason to change this. If you feel otherwise feel free to message me again.
from rxriddles.
@vanniktech I'll message here since I had similar thoughts when doing riddle no 6.
The point is, the solution proposed:
Spoiler
object Riddle6Solution {
fun solve(first: Single<Int>, second: Single<Int>)
= Single.zip(first, second, BiFunction<Int, Int, Pair<Int, Int>> { t1, t2 -> t1 to t2 })
}
does not introduce any parallelism. The comment states:
Execute both [first] and [second] Single's in parallel and provide both results as a pair.
but the solution does not execute any arbitrary pair of singles in parallel. On the contrary, as long as first
and single
doesn't specify schedulers, the solution works sequentially. The solution is appropriate only for this specific use case (implemented in tests), where singles already work on separate scheduler(s).
For actual educational value I'd expect that the provided singles don't have schedulers applied. I believe this is one of the things that are surprising for the beginners: in order to have the two streams work in parallel, we need to move them off the main thread manually, while the riddle suggests otherwise
from rxriddles.
Yup, that's right! Should we add a sentence to the documentation that we can assume that each Single
has already a Scheduler applied? Or how do you want to proceed?
from rxriddles.
@vanniktech took me a while to find time for this, here is my suggestion. I believe not providing a scheduler and not changing the comment is the way to go for this to still be a riddle
;) Let me know what you think
from rxriddles.
Related Issues (8)
- RxSwift HOT 4
- Empty test suite. HOT 9
- RxRiddle 1xx HOT 3
- Confusion with riddle #26 HOT 3
- Question on Riddle #14 HOT 4
- Dependency Dashboard
- Riddle 24 should return Single<Long> HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rxriddles.