- Code: Select all
(defun life (a b)
(cond ((null a) b)
((null b) a)
>(setf a 'oh-boy)
>(life 'gummi a)
What are the global and local values of a and b before, during, and after this command?
plandr, I can help you with your homework if you need a tutor. I won't do your homework for you, but I can make it easier. For example, the COND form in your LIFE function is like a sequence of "if" and "else" statements. "(cond ((null a) b) ((null b) a) (t 'its-tough)))" is equivalent to "if a is null, then return b; otherwise, if b is null, then return a; and if they're both non-null*, then return the symbol ITS-TOUGH." You should be able to look at the values of A and B to figure out what happens in the function.
You can contact me by email if you want some help. My first name is Dan, my last name is Bensen, and my email address is my full name at att.net. Got it? We can work over telephone or email, whichever works best for you.
* (edited per Wodin's correction)