[alexandria-devel] Re: [PATCH] COPY-HASH-TABLE
Tobias C. Rittweiler
tcr at freebits.de
Mon Mar 10 13:57:02 UTC 2008
Michael Weber <michaelw+alexandria at foldr.org> writes:
> On Mar 10, 2008, at 14:20 , Tobias C. Rittweiler wrote:
>
> > The following patch adds a :COPY-FN &key arg to COPY-HASH-TABLE which
> > defaults to CL:IDENTITY.
>
> Why not this?
>
> (defun copy-hash-table (table &key key ...)
> ...
> - (setf (gethash k copy) v))
> + (setf (gethash k copy) (if key (funcall key v) v))
> ...)
>
> Also, I'd rather have other parameters get their default values when
> they are NIL, in the cases when it makes sense. E.g., with the above
> I can do
>
> (defun foo (&key key)
> (copy-hash-table *table* :key key))
>
> without having to worry about the default values.
I agree; I'll send an updated patch which will also add a test case to
tests.lisp!
-T.
More information about the alexandria-devel
mailing list