问题
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 warning messages. For example:
(defun true (X Y) X)
[...]
; caught STYLE-WARNING:
; The variable Y is defined but never used.
Is there a way to warn the compiler that is was intended?
回答1:
See the Common Lisp Hyperspec: Declaration IGNORE, IGNORABLE
(defun true (X Y)
(declare (ignore y))
X)
来源:https://stackoverflow.com/questions/22231465/suppress-warning-for-function-arguments-not-used-in-lisp