[plt-scheme] Re: a few questions

From: Gregory Woodhouse (gregory.woodhouse at sbcglobal.net)
Date: Sun Dec 4 18:15:28 EST 2005

On Dec 4, 2005, at 3:10 PM, Jens Axel Søgaard wrote:

> You forgot a parenthesis before the lambda in the lp-clause:
>
> (define fact
>      (lambda (n)
>        (letrec ([l1 (lambda (m ans)
>                       (lp n 1))]
>                 [lp (lambda (m ans)
>                       (if (= m 0) ans
>                           (l2 m ans)))]
>                 [l2 (lambda (m ans)
>                       (lp (- m 1) (* m ans)))])
>          (l1 '() '()))))
>
> (Note: [] and () mean the same)
>

Thanks (and thanks to everyone else who replied. I messed myself up  
trying to omit the RETURN, I think.) Anyway, this works perfectly.

===
Gregory Woodhouse
gregory.woodhouse at sbcglobal.net

"It is foolish to answer a question that
you do not understand."
--G. Polya ("How to Solve It")





Posted on the users mailing list.