I am trying to understand the "code-is-data" motto in common lisp.
So I have an expression and I want to replace all occurrences of the function list by my-list, as follows.
but how do I check if the symbol list is used as a function in the expression?
So I have an expression and I want to replace all occurrences of the function list by my-list, as follows.
(defparameter *expr* '(let ((list (quote (1 2 3)))) ;; comment list
(append list (list 4 5 'list "list, 'list, LIST"))))
(do-replacement *expr*)
=>(LET ((LIST '(1 2 3)))
(APPEND LIST (MY-LIST 4 5 'LIST "list, 'list, LIST")))
It seems that using the subst or subst-if function is a good idea,but how do I check if the symbol list is used as a function in the expression?