[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
&optional with &key
- To: Robert R. Kessler <KESSLER@UTAH-20.ARPA>
- Subject: &optional with &key
- From: Robert W. Kerns <RWK@SCRC-YUKON.ARPA>
- Date: Tue, 14 May 85 13:02 EDT
- Cc: common-lisp@SU-AI.ARPA
- In-reply-to: The message of 14 May 85 12:05-EDT from Robert R. Kessler <KESSLER@UTAH-20.ARPA>
Date: Tue 14 May 85 10:05:01-MDT
From: Robert R. Kessler <KESSLER@UTAH-20.ARPA>
If you provide an &optional followed by &key's, does that mean that
the &optional becomes required? The examples don't seem to address the
case:
((lambda (a &optional (b 3) &key c (d a))
(list a b c d x))
1 :c 7)
Is this an error (i.e. a is bound to 1, b is bound to :c and 7 causes
the error), or is a bound to 1, b bound to 3, c to 7 and d to 1.
-------
It is an error (i.e. A is bound to 1, B is bound to :C and 7 causes
the error). However, that is not the same as B being required!
All it means is that the keyword arguments start AFTER B. This
implies that you have to supply B in order to supply C or D, but
that's true in (a &optional (b 3) c (d a)), too.