In lisp, I need to define a set of functions, all with the same number of arguments. However, the functions may or may not use all the arguments, leading to a spur of warnin
See the Common Lisp Hyperspec: Declaration IGNORE, IGNORABLE
A variable is not used. Ignore it.
(defun true (x y)
(declare (ignore y))
x)
Above tells the compiler that y
is not going to be used.
The compiler will complain if it is used. It will not complain if it is not used.
A variable might not be used. Don't care.
(defun true (x y)
(declare (ignorable y))
x)
Above tells the compiler that y
might not be used.
The compiler will not complain if it is used and also not if it is not used.