scala/ex.scala
changeset 226 df455e0a9f98
parent 225 0974c59e7029
child 239 ac3309722536
equal deleted inserted replaced
225:0974c59e7029 226:df455e0a9f98
    93   val abc_map = (0 until ns.length).zip(ns).toMap[Int, Int]
    93   val abc_map = (0 until ns.length).zip(ns).toMap[Int, Int]
    94   val start = System.nanoTime()
    94   val start = System.nanoTime()
    95   val res = (abc_f.run(abc_map))(arity)
    95   val res = (abc_f.run(abc_map))(arity)
    96   val end = System.nanoTime()
    96   val end = System.nanoTime()
    97   val time = (end - start)/1.0e9
    97   val time = (end - start)/1.0e9
    98   ("Result: " + res + "  length: " + abc_f.p.length + " time: " + "%.5f".format(time) + "\n Prog:" + abc_f)
    98   ("Result: " + res + "  length: " + abc_f.p.length + " time: " + "%.5f".format(time))
    99 }
    99 }
   100 
   100 
   101 println("S(3)          " + test_comp2(S, 3))
   101 println("S(3)          " + test_comp2(S, 3))
   102 println("Const(1)      " + test_comp2(Const(1), 0))
   102 println("Const(1)      " + test_comp2(Const(1), 0))
   103 println("Const(10)     " + test_comp2(Const(10), 0))
   103 println("Const(10)     " + test_comp2(Const(10), 0))