# [racket] Generative recursion

 From: David Yrueta (dyrueta at gmail.com) Date: Sat Nov 6 21:56:54 EDT 2010 Previous message: [racket] Generative recursion Next message: [racket] Writing type predicates in typed/racket Messages sorted by: [date] [thread] [subject] [author]

```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)))]
>
> (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.
>
> _________________________________________________