Suppose you are running the Lisp interpreter and you enter the following:(defun life (a b) (cond ((null a) b) ((null b) a) (t 'its-tough)))
Then you do the following:> (setf a 'oh-boy)
What are the global and local values of a and b before, during, and after this command?> (life 'gummi a)
(defun who-knows (lst1 lst2) (cond ((= (length lst1) (length lst2)) (+ (length lst1) (length lst2))) ((> (length lst1) (length lst2)) (length lst2)) (t (length lst1))))
Thus, if a list is passed in it should return the proper length, else if a number, or another type of atom is passed in, it should identify them as such.> (blength '(a b c d)) 4 > (blength 'hello) (sorry hello is an atom) > (blength 4) (sorry 4 is a number)
This function takes a list and constructs a new list by taking the first element of the old list and making it the last element of the new. For example:(defun circulate (lst) (append (rest lst) (list (first lst))))
Rewrite the function and call it CIRCULATE-DIR so that it can circulate lists in both directions. Thus it should work as follows:> (circulate '((whats) happening here)) (happening here (whats))
> (circulate-dir '(1 2 3 4) 'left) (4 1 2 3) > (circulate-dir '(1 2 3 4) 'right) (2 3 4 1)
a. (circulate 'hello) b. (circulate nil)
© Colin Allen & Maneesh Dhagat