Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 22. Delimited Continuations > The “Computation with a Hole”

22.2. The “Computation with a Hole”

To understand exactly what a continuation captures, it is useful to think of the shift block as a “hole” inside the reset block. When you invoke the continuation, you can pass a value into the hole, and the computation runs as if the shift had that value. Consider this artificial example:

var cont : (Int => Double) = null
reset {
  0.5 * shift { k : (Int => Double) => cont = k } + 1
}


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial