Introduction to Delimited Continuations/Hiding the shift

The shift block is somewhat tricky to read, and interrupts the visual interpretation of what the run method is intended to do. To clean things up, it can be refactored into a more descriptive method, prompt.

var c: String => Unit = _

def prompt() = shift { k: (String => Unit) => c = k }

def run() = reset {
  println("What is your name?  ** call c(<your name>) to continue **")
  val name = prompt()
  println("Hello, " + name + "!")
}

It is easy to read the run method and have a general idea of what it does, accepting that we're not specific on _how_ prompt prompts for user input.