[racket] Sum of Even
On 9/25/12 11:04 AM, Ashley Fowler wrote:
> I am trying to do a recursive analysis on the Sum of even numbers
> function. So far I have already defined the function. I have found the
> base case. The hard part is finding the non-recursive definition. I'm
> having trouble of what non-recursive definition even means.
>
> Step 1 - Base case: sumEven(N) = 2, if N = 1
>
> Step 2 - Non-recursive definition =
>
> (define sumEven
> (lambda (N)
> (cond((= N 1) 2)
> ((> N 0) (*(+ N 1)N)))))
Sounds like homework to me. Why don't you seek out some help from your
instructor or teaching assistants if there are any.
David