changeset 208 | 3267acc1f97f |
parent 195 | f06aa4e1c25b |
child 221 | 18905d086cbb |
--- a/scala/abacus.scala Fri Mar 01 11:17:50 2013 +0000 +++ b/scala/abacus.scala Fri Mar 01 23:46:02 2013 +0000 @@ -1,5 +1,6 @@ package object abacus { +import scala.annotation.tailrec import lib._ // Abacus instructions @@ -51,7 +52,8 @@ def steps(regs: Regs, n: Int) : AConfig = steps(AConfig(0, regs), n) - def run(cf: AConfig) : AConfig = { + @tailrec + final def run(cf: AConfig) : AConfig = { if (cf.s >= p.length || cf.s < 0) cf else run(step(cf)) }