Question: Common LISP function Give a trace of the function when the input is 5 (defun guess (N) (if (or (zerop N) (= N 1)) 1

Common LISP function

Give a trace of the function when the input is 5

(defun guess (N)

(if (or (zerop N) (= N 1)) 1

(+ (guess (- N 1)) (guess (- N 2)))))

I have ran this code and with the following commands and i get this:

> (trace)

>(guess 5)

1. Trace: (GUESS '5)

1. Trace: (GUESS ==> 8

8

Is this correct or am i doing something wrong plz help.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!