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
Get step-by-step solutions from verified subject matter experts
