anchor.diff:  [source, scala]
   ----
   sealed trait Computation[A]
  +
   class Continue[A](n: => Computation[A]) extends Computation[A] {
  -lazy val next = n
  -}
  +  lazy val next = n
  +}
  +
   case class Done[A](result: A) extends Computation[A]
  -def even(i: Int): Computation[Boolean] = i match {
  -case 0 => Done(true)
  -case _ => new Continue(odd(i - 1))
  -}
  -def odd(i: Int): Computation[Boolean] = i match {
  -case 0 => Done(false)
  -case _ => new Continue(even(i - 1))
  -}
  -@tailrec
  -def run[A](computation: Computation[A]): A = computation match {
  -case Done(a) => a
  -case c: Continue[A] => run(c.next)
  -}
  +  def even(i: Int): Computation[Boolean] = i match {
  +    case 0 => Done(true)
  +    case _ => new Continue(odd(i - 1))
  +  }
  +
  +  def odd(i: Int): Computation[Boolean] = i match {
  +    case 0 => Done(false)
  +    case _ => new Continue(even(i - 1))
  +  }
  +
  +  @tailrec
  +  def run[A](computation: Computation[A]): A = computation match {
  +    case Done(a) => a
  +    case c: Continue[A] => run(c.next) 
  +  }
   ----
   
   ## Recursion and Trampolines in Scala
  
positive.code: [source, scala]
  ----
  sealed trait EvenOdd
  case class Done(result: Boolean) extends EvenOdd
  case class Even(value: Int) extends EvenOdd
  case class Odd(value: Int) extends EvenOdd
  def even(i: Int): EvenOdd = i match {
  case 0 => Done(true)
  case _ => Odd(i - 1)
  }
  def odd(i: Int): EvenOdd = i match {
  case 0 => Done(false)
  case _ => Even(i - 1)
  }
  ----
  
  
negative.code: [source, scala]
  ----
  import scala.util.control.TailCalls.{ TailRec, done, tailcall }
  
  def even(i: Int): TailRec[Boolean] = i match {
    case 0 => done(true)
    case _ => tailcall(odd(i - 1))
  }
   
  def odd(i: Int): TailRec[Boolean] = i match {
    case 0 => done(false)
    case _ => tailcall(even(i - 1))
  }
  
  even(3000).result
  ----
  
  