[racket] Generative recursion

From: Ken Hegeland (hegek87 at yahoo.com)
Date: Sat Nov 6 12:37:40 EDT 2010

I have been trying to take a break for the weekend and I am going to try to go back at it with a fresh perspective Monday. 

One
 thought I did have though, you said tabulate-div means we want all the 
divisors of 20, so the next step would be tab-div(sub1 n), or 19, Im 
thinking that would mean all the divisors of 19. But I cant think how 
that is relevant.

Just so I understand, my idea of what exactly 
generative recursion is that it takes some input data, applies it to a 
helper function, changes the value to the answer of the helper function 
and restarts the generative function. Is this a correct understanding?
so
 if the helper function was (/ n 2) and the original n was 20, it would 
apply 20 to / n 2, and then restart the whole function with 10 as the 
new n.

I know you said to forget the whole idea of gr, but I 
still think about it a lot.
 the method you gave, would there still be a trivially solvable problem?
 I know I will get it eventually, but this problem seems pretty 
challenging, maybe I am over-complicating it. One final question I have,
 would reading ahead in the book to see more of there examples help me 
out?

edit, to find the solution of the first problem I had the idea of 20/20, or n/n, my problem is wouldn't this just lead to (list 1 1 1 1 1)? since everytime it passes the generative step, in my understanding, it does the entire function again with all occoruences of n replaced with (helper n)
An example I hope can clarify  my question is, say I have the final clause be
[else(list(/ n n)
            (tabulate-div(next-divisor n(sub1 n))))]))

And next divisor does what it implies, next-divisor of 20 19 would find that it goes until 10.
It would then take 10 and re-do the function.
So, it would check if n=10 is trivially solvable, then go to the next step, doing list /10 10. then do next divisor of 10 9, leading to 5. 

I've read through wooks post a few times and I have been trying it but I will ultimately be spending a lot more time on it Monday, this are just some concerns I have right now.



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

Posted on the users mailing list.