(defun proc (arg1 &key (key #'INITFORM))
(...(key arg1))
--
-------------------------
Mark A. DePristo
m-dep...@nwu.edu
http://osiris.res-hall.nwu.edu/
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: 2.6.2
mQCNAzNfvt4AAAEEAMmJsOWRlRfc1xVYxf1/ioAHRJzpjlzT/6dudTtsqR9Ciflt
k+gEXQ+sWjGPpmzupU40zXUVrVOfu2Cvd3Nf/EMDThUuHQGHMh5Wurae3hglPoG7
kOZ4sEt4YqSamDv1EIQ/0p2YRSqIPQXrf4HVmyRBjOxwxyOkJqF5Hvi/LFStAAUR
tCVNYXJrIEEuIERlUHJpc3RvIDxtLWRlcHJpc3RvQG53dS5lZHU+
=tRFR
-----END PGP PUBLIC KEY BLOCK-----
-------------------------
The problem isn't with the defaulting, that's fine. The problem is with
the way you're calling the key function. It should be (funcall key arg1).
This is Common Lisp, not Scheme, so the functional position in a form is
not evaluated.
--
Barry Margolin, bar...@bbnplanet.com
BBN Corporation, Cambridge, MA
Support the anti-spam movement; see <http://www.cauce.org/>
>
> I'd like to define a procedure -- not the actual function. I'd like to
> allow a keyword argument KEY such that KEY is applied to arg1 before
> arg1 is process. However, I can't seem to figure out the value I should
> use for the INITFORM of key in the argument list. Ideally, KEY will
> have a initform that will not have any affect on arg1. How is this
> traditionally done in Lisp? Thanks.
>
> (defun proc (arg1 &key (key #'INITFORM))
> (...(key arg1))
>
Assuming I understand what you are trying to do, consider:
(defun proc (arg1 &key (key #'identity))
(... (funcall key arg1) ...))
--
Thomas A. Russ, USC/Information Sciences Institute t...@isi.edu
#'identity is what you should use for the default key function.
It simply returns its argument, and is implicitly used for the :key
value for all the CL sequence functions.
However, an actual implementation would probably not be done this way.
BTW, you need to use FUNCALL to call the key function.
(defun proc (arg1 &key (key #'identity))
(... (funcall key arg1)))
-Kelly Murray k...@franz.com http://www.franz.com