0

I know the following sound a homework problem but it not it a study guild I to study but i am stuck. I really need help. I dont want to fail the test tomorrow

The following C code defines Fibonacci function

int fib (int n)
{
   if  (n == 0) return 0;
   else if (n == 1) return 1;
   else
    return (fib(n-1) + fib(n-2));
}

Define Fibonacci function in Scheme. Use fib as a function name

What does the following Scheme function do? Explain your answer.

(DEFINE (guesslis)
    (COND 
        ((NULL? lis) '())
            (ELSE (append(guess(CDR lis)) (LIST(CAR lis))))

What is the result of (guess ‘(A B C))? Show the derivation process

2
Contributors
2
Replies
22
Views
2 Years
Discussion Span
Last Post by My_1
1

Scheme is basically Lisp. Sounds like you need to do some more study here. This may not be school work, but it looks a lot like homework for a course you are taking, even if an online one. Do you know how to write a recursive Scheme function? That is what you need to do for the fib() function.

0

since my teacher didnt give the number for fib what number am i using?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.