make-translator-fun

Paul Werkowski pw at snoopy.qozzy.com
Sat Jan 9 18:20:09 UTC 2021


(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))
               , at body)))
         (t
          `(lambda (,(car args) &key ,@(cdr args) &allow-other-keys)
             (declare (ignorable ,(car args)))
             , at 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





More information about the mcclim-devel mailing list