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

Michael Weber michaelw+alexandria at foldr.org
Mon Mar 10 14:55:53 UTC 2008


On Mar 10, 2008, at 15:42 , Tobias C. Rittweiler wrote:

> +(defun copy-hash-table (table &key copy-fn test size
> +                                   rehash-size rehash-threshold)
> +  "Returns a copy of hash table TABLE, with the same keys and values
>  as the TABLE. The copy has the same properties as the original,  
> unless
> -overridden by the keyword arguments."
> +overridden by the keyword arguments.
> +
> +The values are copied by calling COPY-FN which defaults to  
> CL:IDENTITY;
> +thus a shallow copy is returned by default."
> +  (setf copy-fn (or copy-fn 'identity))

I'd really rather see :key there instead of :copy-fn.
Reason: it's in line with other CL functions, and it can be used that  
way, e.g.:
     (copy-hash-table *table* :key #'accessor)

That there is copying involved is rather secondary.

Also, I find :copy-fn ugly in comparison to :key, but YMMV.


M/




More information about the alexandria-devel mailing list