main_templates3/re.scala
changeset 400 e48ea8300b2d
parent 396 3ffe978a5664
child 418 fa7f7144f2bb
--- a/main_templates3/re.scala	Sat Nov 06 00:06:39 2021 +0000
+++ b/main_templates3/re.scala	Mon Nov 08 00:17:50 2021 +0000
@@ -130,15 +130,15 @@
   val start = System.nanoTime()
   for (j <- 1 to i) code
   val end = System.nanoTime()
-  (end - start)/(i * 1.0e9)
+  "%.5f".format((end - start)/(i * 1.0e9))
 }
 
 for (i <- 0 to 5000000 by 500000) {
-  println(i + " " + "%.5f".format(time_needed(2, matcher(EVIL, "a" * i))))
+  println(s"$i ${time_needed(2, matcher(EVIL, "a" * i))} secs.") 
 }
 
 // another "power" test case 
-simp(Iterator.iterate(ONE:Rexp)(r => SEQ(r, ONE | ONE)).drop(50).next) == ONE
+simp(Iterator.iterate(ONE:Rexp)(r => SEQ(r, ONE | ONE)).drop(50).next()) == ONE
 
 // the Iterator produces the rexp
 //