[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: INFO-LISPM at MIT-AI
- From: BAK at MIT-AI (William A. Kornfeld)
- Date: Sun ,19 Aug 79 23:40:00 EDT
I have a couple of macros that allow you to define functions to take keyed arguments.
For example, a function defined as follows:
(defun-keyed foo (arg1 &keyed arg2 arg3) ... )
takes one unkeyed and two keyed arguments. An invocation of this function might
(foo '(a b)
arg3 '(c d)
arg2 '(e f))
The keyed arguments can go in any order. It also knows about optional arguments and
in particular gets around the screw of not getting the defaults of optionals arguments
early on the arglist because you wanted to specify a later optional argument. I have
found keyed arguments most useful in situations where there are many optional arguments
and you only want to specify one or two at a time.
The package introduces no inefficiencies except at macro-expansion time and is
relatively transparent to the user. It currently does not run under MACLISP, though
this should be fixed soon. The code is in BAK;DEFKEY QFASL and documentation at the
front of BAK;DEFKEY > . Comments and suggestions appreciated.