[plt-scheme] multiply-by-pi HTDP 11.5.2

From: Robby Findler (robby at cs.uchicago.edu)
Date: Tue Jun 20 15:16:29 EDT 2006

I think you're forgetting the template (and, judging from the below you
maybe missed your contract & purpose). You're right that that approach
won't work, but maybe you can find another way to use your inputs.

Robby

At Tue, 20 Jun 2006 19:50:20 +0100, "wooks wooks" wrote:
> 
> http://www.htdp.org/2003-09-26/Book/curriculum-Z-H-15.html#node_sec_11.5
> 
> I can only solve this problem by using + for  the recursion. because my add 
> function only works when at least one of the inputs is a natural number - 
> i.e
> 
> (define (add m n)
>   (cond
>     [(zero? n) m]
>     [else (add1 (add m (sub1 n)))]
>     )
>   )
> 
> which will obvious not work for the required recursion (add pi 
> (multiply-by-pi (- n 1))).
> 
> 
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme


Posted on the users mailing list.