diff options
author | Martin Odersky <odersky@gmail.com> | 2009-05-08 16:33:15 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2009-05-08 16:33:15 +0000 |
commit | 14a631a5fec42d04d0723355a0b93e482b5e4662 (patch) | |
tree | f639c2a22e89e193b9abea391993ecfd4d5326ee /src/library/scalax/util/control/TailRec.scala | |
parent | 2379eb4ebbd28c8892b50a1d9fa8a687099eea4d (diff) | |
download | scala-14a631a5fec42d04d0723355a0b93e482b5e4662.tar.gz scala-14a631a5fec42d04d0723355a0b93e482b5e4662.tar.bz2 scala-14a631a5fec42d04d0723355a0b93e482b5e4662.zip |
massive new collections checkin.
Diffstat (limited to 'src/library/scalax/util/control/TailRec.scala')
-rw-r--r-- | src/library/scalax/util/control/TailRec.scala | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/src/library/scalax/util/control/TailRec.scala b/src/library/scalax/util/control/TailRec.scala deleted file mode 100644 index db6cbfa2ed..0000000000 --- a/src/library/scalax/util/control/TailRec.scala +++ /dev/null @@ -1,24 +0,0 @@ -package scala.util.control - -abstract class TailRec[+A] - -object TailRec { - - case class Call[A](rest: () => TailRec[A]) extends TailRec[A] - case class Done[A](result: A) extends TailRec[A] - - def tailcall[A](rest: => TailRec[A]) = new Call(() => rest) - def done [A](result: A) = new Done(result) - def trampoline[A](body: TailRec[A]): A = { - def loop(body: TailRec[A]): A = body match { - case Call(rest) => loop(rest()) - case Done(result) => result - } - loop(body) - } - def loop[A](body: TailRec[A]): A = body match { - case Call(rest) => loop[A](rest()) - case Done(result) => result - } -} - |