I'm new to lisp and going through ANSI Common Lisp by Paul Graham and one of the exercises is to define a function like apply where any number printed out before it returns will be printed by default in octal.
I tried the following:
(let ((*print-base* 8))
(defun like-apply (&rest args)
(apply #'apply args)))
But it didn't work as expected:
(like-apply #'princ '(8)); returns 8 8 (expecting 10 8)
The following however works:
(defun apply8 (&rest args)
(let ((*print-base* 8))
(apply #'apply args)))
Returns correctly:
(apply8 #'princ '(8)); returns 10 8 (as expected)
So my question is why does the second example work, but not the first one? Both seem to manipulate the *print-base* variable.