Lambda the Ultimate

inactiveTopic Kata Two: Iteration, Recursion and Continuations
started 8/31/2003; 8:48:03 PM - last post 8/31/2003; 8:48:03 PM
Chris Rathman - Kata Two: Iteration, Recursion and Continuations  blueArrow
8/31/2003; 8:48:03 PM (reads: 10639, responses: 0)
Kata Two: Iteration, Recursion and Continuations
As long as I'm mining his site, I thought I'd link to the more involved series that Jim Weirich put together that serves as nice introduction to continuations. In conjunction with Dan Sugalski's talks about Continuations, CPS, TailRecursion, and more, I might just be able to figure out how to get the CallCC function to work in my unlambda interepreter. :-)

PragDave has put together some programming "practice" exericises that he calls Katas. In Kata number two he suggests writing a binary search function, not once, but five different ways. Now Iíve implemented a binary search several times, but writing it five times in five different ways was intriguing.

  1. Iterative with Loop Invariants
  2. Recursive
  3. Recursive with Explicit Limits
  4. Continuation Passing Style
  5. Eliminating Tail Recursion

The series of implementations given is a nice perspective on the different styles used solving the same problem - thus giving a fair basis for comparison.
Posted to OOP by Chris Rathman on 8/31/03; 8:52:54 PM