equal
deleted
inserted
replaced
136 CPSi(e6) |
136 CPSi(e6) |
137 |
137 |
138 val e7 = Call("foo", List(Num(3))) |
138 val e7 = Call("foo", List(Num(3))) |
139 CPSi(e7) |
139 CPSi(e7) |
140 |
140 |
141 val e8 = Call("foo", List(Num(3), Num(4), Aop("+", Num(5), Num(6)))) |
141 val e8 = Call("foo", List(Aop("*", Num(3), Num(1)), Num(4), Aop("+", Num(5), Num(6)))) |
142 CPSi(e8) |
142 CPSi(e8) |
143 |
143 |
144 val e9 = Sequence(Aop("*", Var("a"), Num(3)), Aop("+", Var("b"), Num(6))) |
144 val e9 = Sequence(Aop("*", Var("a"), Num(3)), Aop("+", Var("b"), Num(6))) |
145 CPSi(e9) |
145 CPSi(e9) |
146 |
146 |
237 for (j <- 1 to i) code |
237 for (j <- 1 to i) code |
238 val end = System.nanoTime() |
238 val end = System.nanoTime() |
239 (end - start)/(i * 1.0e9) |
239 (end - start)/(i * 1.0e9) |
240 } |
240 } |
241 |
241 |
|
242 // for Scala 2.12 |
|
243 /* |
|
244 def deserialise[T](file: String) : Try[T] = { |
|
245 val in = new ObjectInputStream(new FileInputStream(new File(file))) |
|
246 val obj = Try(in.readObject().asInstanceOf[T]) |
|
247 in.close() |
|
248 obj |
|
249 } |
|
250 */ |
|
251 |
242 def deserialise[T](fname: String) : Try[T] = { |
252 def deserialise[T](fname: String) : Try[T] = { |
243 import scala.util.Using |
253 import scala.util.Using |
244 Using(new ObjectInputStream(new FileInputStream(fname))) { |
254 Using(new ObjectInputStream(new FileInputStream(fname))) { |
245 in => in.readObject.asInstanceOf[T] |
255 in => in.readObject.asInstanceOf[T] |
246 } |
256 } |