[racket] Missionaries and cannibals

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Tue Nov 30 18:12:21 EST 2010

On Nov 30, 2010, at 4:09 PM, Ken Hegeland wrote:

> In the book it said that generally an accumulator should be added after completing the function, is it not possible without one, or is it just very difficult?


It says that for STRUCTURALLY RECURSIVE FUNCTIONS you can usually get away w/o an accumulator. But it is easier to formulate certain problems with accumulators. 

Solving a puzzle where you can easily generate an infinite sequence of 'boat trips' that correspond to an infinite loop in computing implies that you are looking at a GENERATIVE RECURSIVE FUNCTION. 

Next: 
 one step with the introduction of accumulators is to exploit the knowledge that is accumulated. 
 This may mean checking for cycles in a graph or cycles in boat trips. 

Try that -- Matthias



Posted on the users mailing list.