(defun make-translator-fun (args body) (cond ((null args) (warn "OBJECT parameter is obligatory (adding ignored parameter)") (let ((object-arg (gensym "OBJECT-ARG"))) `(lambda (,object-arg &key &allow-other-keys) (declare (ignore ,object-arg)) ,@body))) (t `(lambda (,(car args) &key ,@(cdr args) &allow-other-keys) (declare (ignorable ,(car args))) ,@body))))
I guess the above does the right thing if ARGS is NIL but won't catch the case of ARGS incorrectly given as, for instance, (x y window) instead of (object x y window).
Paul