Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!gatech!ncar!ames!sun-barr!cs.utexas.edu!uunet!philmtl!philabs!linus!mbunix!bds From: bds@mbunix.mitre.org (Barry D Smith) Newsgroups: comp.lang.lisp Subject: optional and key arguments Message-ID: <64922@linus.UUCP> Date: 22 Aug 89 19:36:48 GMT Sender: news@linus.UUCP Reply-To: bds@mbunix (Smith) Distribution: comp.lang.lisp Organization: The MITRE Corporation, Bedford, Mass. Lines: 20 Since we were just burnt by this on a Symbolics, I wonder if anyone would comment: Given the function: (defun test (a b &optional (c 0) &key (d 1)) (if (= d 1) (+ a b c d) (+ a b c))) (test 5 4 :d 0) results in an error. Since optional arguments are evaluated first, c is bound to :d, and 0 isn't a key argument. Is this the Common Lisp standard? If so, does it make sense? In our case, we had 3 optional arguments, and we wanted to use the default values, but to set the key argument to something else. It seems a violation of the notion of optional arguments to have to specify them. Barry Smith