[alexandria-devel] [PATCH] COPY-HASH-TABLE

Michael Weber michaelw+alexandria at foldr.org
Mon Mar 10 13:33:07 UTC 2008


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.



Cheers,
Michael




More information about the alexandria-devel mailing list