cws/cw04.tex
changeset 292 a52987bf44e1
parent 289 08b5ddbc7e55
child 307 3c7ac7836e4f
--- a/cws/cw04.tex	Wed Oct 30 14:27:54 2019 +0000
+++ b/cws/cw04.tex	Wed Oct 30 21:56:46 2019 +0000
@@ -144,19 +144,19 @@
 $ scala -cp re.jar
 scala> import CW9c._  
 scala> for (i <- 0 to 5000000 by 500000) {
-  | println(i + " " + "%.5f".format(time_needed(2, matcher(EVIL, "a" * i))) + "secs.")
+  | println(f"$i: ${time_needed(2, matcher(EVIL, "a" * i))}%.5f secs.")
   | }
-0 0.00002 secs.
-500000 0.10608 secs.
-1000000 0.22286 secs.
-1500000 0.35982 secs.
-2000000 0.45828 secs.
-2500000 0.59558 secs.
-3000000 0.73191 secs.
-3500000 0.83499 secs.
-4000000 0.99149 secs.
-4500000 1.15395 secs.
-5000000 1.29659 secs.
+0: 0.00002 secs.
+500000: 0.10608 secs.
+1000000: 0.22286 secs.
+1500000: 0.35982 secs.
+2000000: 0.45828 secs.
+2500000: 0.59558 secs.
+3000000: 0.73191 secs.
+3500000: 0.83499 secs.
+4000000: 0.99149 secs.
+4500000: 1.15395 secs.
+5000000: 1.29659 secs.
 \end{lstlisting}%$