next up previous
Next: 13 Iteration Up: 12 Recursion Previous: 12.8 Using Scheme Notation

12.9 Using J Notation

Consider the factorial function defined in Section 12.3 and evaluate factorial 5. Five continuations must be formed during this evaluation. They are:

c1 =: monad define'5 * y.'
c2 =: monad define'4 * y.'
c3 =: monad define'3 * y.'
c4 =: monad define'2 * y.'
c5 =: monad define'1 * y.'

Then the value of factorial 5 may be written as

c1 c2 c3 c4 c5 1


next up previous
Next: 13 Iteration Up: 12 Recursion Previous: 12.8 Using Scheme Notation
2002-11-26