Lecture overview -- Keyboard shortcut: 'u'  Previous page: The intuition behind continuations -- Keyboard shortcut: 'p'  Next page: The capturing of continuations -- Keyboard shortcut: 'n'  Lecture notes - all slides and notes together  slide -- Keyboard shortcut: 't'  Textbook -- Keyboard shortcut: 'v'  Help page about these notes  Alphabetic index  Course home    Lecture 3 - Page 37 : 42
Functional Programming in Scheme
Name binding, Recursion, Iteration, and Continuations
Being more precise

Instead of relying of an informal understanding of continuations we will now introduce lambda expressions that represent the continuations.

We can form a lambda expression that to some degree represents a continuation

Context C and expression E

The continuation of E in C

(+ 5 (* 4 3))
(lambda (e) (+ 5 e))
(cons 1 (cons 2 (cons 3 '())))
(lambda (e) 
  (cons 1 (cons 2 (cons 3 e))))
(define x 5)
(if (= 0 x)
    'undefined
    (remainder 
     (* (+ x 1) (- x 1))
     x))
(lambda (e) 
  (remainder (* e (- x 1)) x))

A more precise notation of the continuations of E