We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 08f5c4f commit cbbc39eCopy full SHA for cbbc39e
src/main/scala/org/learningconcurrency/exercises/ch6/Ex3.scala
@@ -24,11 +24,14 @@ object Ex3 extends App {
24
25
def randomQuoteMock = Observable.interval(1 seconds).map((l) => randomString(Random.nextInt(10)+1))
26
27
- randomQuoteMock.scan((0D,0)){
28
- (n,q) => n match {
29
- case (s,c) => (s + q.length, c + 1)
+ randomQuoteMock.scan((0D,0)) {
+ (n, q) => n match {
+ case (s, c) => (s + q.length, c + 1)
30
}
31
- }.filter(_._2 != 0).map((e) => e._1/e._2).subscribe((e) => log(s"avg = $e"))
+ }
32
+ .tail
33
+ .map((e) => e._1 / e._2)
34
+ .subscribe((e) => log(s"avg = $e"))
35
36
Thread.sleep(10000)
37
0 commit comments