Our next obscure Lisp feature is the symbol-macrolet special operator. This operator produces a context in which one or more symbols can be rewritten prior to evaluation. While let, and similar operators, can shadow it, outside of that exception, the symbols are substituted according to the expansions supplied.
Here is some code to demonstrate the behaviour:
(defun demonstrate () (let ((replacement-1 'my-new-fcn-1)) (symbol-macrolet ((my-fcn-1 replacement-1) (my-fcn-2 'rpl-2)) (format t "(my-fcn-1 my-fcn-2): ~A~%" (list my-fcn-1 my-fcn-2)) (format t "Now, binding to shadow my-fcn-2~%") (multiple-value-bind (result my-fcn-2) (floor 10.4 1.2) (format t "(my-fcn-1 my-fcn-2): ~A~%" (list my-fcn-1 my-fcn-2))))))
with output:
CL-USER> (demonstrate) (my-fcn-1 my-fcn-2): (MY-NEW-FCN-1 RPL-2) Now, binding to shadow my-fcn-2 (my-fcn-1 my-fcn-2): (MY-NEW-FCN-1 0.79999924) NIL