(i) Given the C macro below, show the expanded code produced by the statement x = Min4(1,2,3,4); and then show the resulting value of variable x.
#define Min4(w,x,y,z) Min(Min(w,x),Min(y,z)) #define Min(x,y) (x |
(ii) Given the Lisp macro below, show the expanded code produced by the statement (creative Recursion) and then show the result of the subsequent call (Recursion "wonderful" 2).
(defmacro creative (fname) `(defun ,fname (text N) (cond ((not (integerp N)) nil) ((< N 1) nil) (t (format t "~A is a ~A thing~%" (symbol-name (quote ,fname)) text) (,fname text (- N 1)))))) |