progs/lecture1.scala
changeset 329 828326d1b3b2
parent 316 03d55eb6a0b7
child 335 9476aee44eed
--- a/progs/lecture1.scala	Tue Dec 03 11:07:09 2019 +0000
+++ b/progs/lecture1.scala	Mon Jan 27 10:18:13 2020 +0000
@@ -425,7 +425,17 @@
 // - no vars, no ++i, no +=
 // - no mutable data-structures (no Arrays, no ListBuffers)
 
-// But what the heck....
+// But what the heck....lets try to count to 1 Mio in parallel
+
+var cnt = 0
+
+for(i <- (1 to 1000000).par) cnt += 1
+
+println(s"Should be 1 Mio: $cnt")
+
+
+
+// Or
 // Q: Count how many elements are in the intersections of 
 //    two sets?
 // A; IMPROPER WAY (mutable counter)