next up previous
Next: 5 Iteration Up: 4 Expressing Recursion as Previous: 4.1 Using Scheme Notation

4.2 Using J Notation

Consider the factorial function defined in Section 2.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: 5 Iteration Up: 4 Expressing Recursion as Previous: 4.1 Using Scheme Notation
2002-11-26