[cl-containers-devel] insert-new-item should apply key to item

Gary King gwking at metabang.com
Thu Jun 19 12:46:24 UTC 2008


Hi Daniel,

I think you are completely right. Thanks for the patch. File  
extensions are a nightmare from which we're all trying to awake (but I  
like "changes" :).

I will apply this later today.

On Jun 18, 2008, at 9:33 PM, Daniel Dickison wrote:

> I just started using cl-containers and found insert-new-item to be a  
> bit puzzling when used with a container with a specified :key.   
> Namely, I think insert-new-item should apply the key function to the  
> new item in addition to applying it to the items already in the  
> container.  Otherwise, you get weirdness like:
>
> CL-USER> (defparameter foo (make-instance 'cl-containers:sorted-list- 
> container
>                                          :test #'equalp
>                                          :key #'car))
> FOO
> CL-USER> (cl-containers:insert-new-item foo '(1 a))
> CL-USER> (cl-containers:print-container foo)
> ((1 A))
> CL-USER> (cl-containers:insert-new-item foo '(1 a))
> CL-USER> (cl-containers:print-container foo)
> ((1 A) (1 A))
>
> I think it makes sense to apply the key to the new item in all  
> cases, but there might be some case I'm not thinking of.  Attached  
> is a patch.
>
> Daniel
>
> P.S. What's a good file extension for darcs patches?
>
> <insert-new-item.changes>
> _______________________________________________
> cl-containers-devel mailing list
> cl-containers-devel at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/cl-containers-devel

--
Gary Warren King, metabang.com
Cell: (413) 559 8738
Fax: (206) 338-4052
gwkkwg on Skype * garethsan on AIM







More information about the cl-containers-devel mailing list