[plt-scheme] HtDP: Another question on 10.1.9

From: Grant Rettke (grettke at acm.org)
Date: Fri Sep 19 23:44:10 EDT 2008

On Fri, Sep 19, 2008 at 7:29 PM, Carl Eastlund <cce at ccs.neu.edu> wrote:
> On Fri, Sep 19, 2008 at 10:51 AM, Grant Rettke <grettke at acm.org> wrote:
>>
>> I followed (abused?) a recipe by using cond and having the first
>> clause handle any amount under 100. It looks like this:
>>
>> (cond
>>    [(< n 100) <cents part goes here>]
>>    [else (cons <dollar amount and natural recusion occur here>)])
>
> Natural recursion?  What's so natural about it?

You don't need to do all of the work at once, you handle the part that
you need and let the function do the rest of it. In this case, the
rest is everything under 100. Is this a valid approach if there is
only one recursive step?

Or were you just giving me a hard time with your reply?


Posted on the users mailing list.