[racket] Generative recursion

From: Ken Hegeland (hegek87 at yahoo.com)
Date: Sat Nov 6 17:24:13 EDT 2010

Something that looks like this:

(define(tabulate1 n i)
[(> i n)empty]
[(=(remainder n i)0)(cons i(tabulate1 n(add1 i)))]
[else(tabulat1 n(add1 i))]))

(define(tabulate n)
(tabulate1 n 1))

 feel like I understand how it works recursively, just the generative 
recursion method makes me struggle. I do fully understand how move-ball,
 quick-sort, and gcd-generative work, this problem eludes me though. I 
have been re-reading what you say and nothing is really standing out 
just yet. I think whats really hurting me here is the fact that in the 
other examples the type of output matches the input(i.e ball becomes a 
ball with + x-delta and + y-delta, a list becomes a new list, 2 natural numbers become one.) It's throwing me off that a natural number should create a list.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20101106/f4aa832f/attachment.html>

Posted on the users mailing list.