[cl-containers-devel] insert-new-item should apply key to item
Daniel Dickison
danieldickison at gmail.com
Thu Jun 19 01:33:56 UTC 2008
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?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: insert-new-item.changes
Type: application/octet-stream
Size: 471 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/cl-containers-devel/attachments/20080618/c5d17e51/attachment.obj>
-------------- next part --------------
More information about the cl-containers-devel
mailing list