progs/re3.scala
changeset 119 a6684e8961d0
parent 93 4794759139ea
child 121 43c116860e47
--- a/progs/re3.scala	Mon Sep 30 20:03:41 2013 +0100
+++ b/progs/re3.scala	Tue Oct 01 23:59:36 2013 +0100
@@ -85,11 +85,10 @@
 def matcher(r: Rexp, s: String) : Boolean = nullable(ders(s.toList, r))
 
 
-
 //one or zero
 def OPT(r: Rexp) = ALT(r, EMPTY)
 
-def RTEST(n: Int) = SEQ(NTIMES(OPT("a"), n), NTIMES("a", n))
+def EVIL(n: Int) = SEQ(NTIMES(OPT("a"), n), NTIMES("a", n))
 
 def time_needed[T](i: Int, code: => T) = {
   val start = System.nanoTime()
@@ -100,7 +99,7 @@
 
 
 for (i <- 1 to 11001 by 500) {
-  println(i + " " + + " " + time_needed(1, matcher(RTEST(i), "a" * i)))
+  println(i + " " + "%.5f".format(time_needed(1, matcher(EVIL(i), "a" * i))))
 }