In my function I am reading input from the user which is expected to be a lisp form given as a string e.g.:
(sym1 sym2 (sym3 sym4))
My goal is to substitute some of the symbols with other symbols e.g.:
(sublis '((sym1 . sym1%)
(sym2 . sym2%))
str)
Because I am getting the input as a string, I am first converting it to a lisp form. Here is how the final function looks like:
(defun sublis-when-string (str)
(sublis '((sym1 . sym1%)
(sym2 . sym2%))
(read-from-string str)))
When I compile the function and run it in the REPL with (sublis-when-string "(sym1 sym3 (sym2 sym4))") I correctly get:
(SYM1% SYM3 (SYM2% SYM4))
However when I run the whole program the substitutions do not work:
(SYM1 SYM3 (SYM2 SYM4))
This lead me to believe that the problems is with the package. When I changed the package in the REPL the substitutions were still not working.
My question is: How should I change my function so it works when called from other packages?