[racket] Generative recursion
Hi Ken --
Just a quick question to make sure we are all on the "same page," as it
were: have you completed all exercises in prior sections?
Dave
On Sat, Nov 6, 2010 at 2:24 PM, Ken Hegeland <hegek87 at yahoo.com> wrote:
> Something that looks like this:
>
> (define(tabulate1 n i)
> (cond
> [(> i n)empty]
> [(=(remainder n i)0)(cons i(tabulate1 n(add1 i)))]
> [else(tabulat1 n(add1 i))]))
>
> (define(tabulate n)
> (tabulate1 n 1))
>
> I 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.
>
> _________________________________________________
> For list-related administrative tasks:
> http://lists.racket-lang.org/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20101106/013d37e6/attachment.html>