by fiddlerwoaroof · 5y ago · 0 comments
def foo(str):
v = str(1)
. . .
Which resulted in head-scratching errors like “str is not a function”.EDIT: I agree that hygienic macros aren't the right way to solve this issue.
CL-USER> (defun foo (list) (list list))
FOO
CL-USER> (foo 42)
(42)
In this case the function attached to the symbol LIST is applied to the argument with the same name, but that isn't a problem.To further illustrate, in the above example the LIST symbol is imported from the package COMMON-LISP and has a function, plist etc. attached to it:
CL-USER> (symbol-package 'list)
#<PACKAGE "COMMON-LISP">
CL-USER> (symbol-function 'list)
#<FUNCTION LIST>
CL-USER> (symbol-plist 'list)
NIL