We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 24fca40 commit 6e2bab9Copy full SHA for 6e2bab9
hello-akka-stream/src/main/scala/example/Hello.scala
@@ -12,9 +12,13 @@ import java.nio.file.Paths
12
object Hello extends App {
13
implicit val system = ActorSystem("QuickStart")
14
15
- val source: Source[Int, NotUsed] = Source(1 to 100)
16
- val done: Future[Done] = source.runForeach(i => println(i))
+ val factorials = Source(1 to 100).scan(BigInt(1))((acc, next) => acc * next)
+
17
+ val result = factorials
18
+ .zipWith(Source(0 to 100))((num, idx) => s"$idx! = $num")
19
+ .throttle(1, 1.second)
20
+ .runForeach(println)
21
22
implicit val ec = system.dispatcher
- done.onComplete(_ => system.terminate())
23
+ result.onComplete(_ => system.terminate())
24
}
0 commit comments