From danieldickison at gmail.com Thu Jun 19 01:33:56 2008 From: danieldickison at gmail.com (Daniel Dickison) Date: Wed, 18 Jun 2008 21:33:56 -0400 Subject: [cl-containers-devel] insert-new-item should apply key to item Message-ID: <690DAD6D-30D4-4DB9-8C84-01304790A03E@gmail.com> 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: -------------- next part -------------- From gwking at metabang.com Thu Jun 19 12:46:24 2008 From: gwking at metabang.com (Gary King) Date: Thu, 19 Jun 2008 08:46:24 -0400 Subject: [cl-containers-devel] insert-new-item should apply key to item In-Reply-To: <690DAD6D-30D4-4DB9-8C84-01304790A03E@gmail.com> References: <690DAD6D-30D4-4DB9-8C84-01304790A03E@gmail.com> Message-ID: <46E3DB89-9972-4ACF-A04A-AF4C9CD22456@metabang.com> 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? > > > _______________________________________________ > 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 From gwking at metabang.com Fri Jun 20 13:37:50 2008 From: gwking at metabang.com (Gary King) Date: Fri, 20 Jun 2008 09:37:50 -0400 Subject: [cl-containers-devel] insert-new-item should apply key to item In-Reply-To: <690DAD6D-30D4-4DB9-8C84-01304790A03E@gmail.com> References: <690DAD6D-30D4-4DB9-8C84-01304790A03E@gmail.com> Message-ID: <667D9EA8-F81D-475C-98F9-7A3E51628F91@metabang.com> Daniel, Your patch went out last night. Thanks again. 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? > > > _______________________________________________ > 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 From danieldickison at gmail.com Sat Jun 21 11:08:45 2008 From: danieldickison at gmail.com (Daniel Dickison) Date: Sat, 21 Jun 2008 07:08:45 -0400 Subject: [cl-containers-devel] insert-new-item should apply key to item In-Reply-To: <667D9EA8-F81D-475C-98F9-7A3E51628F91@metabang.com> References: <690DAD6D-30D4-4DB9-8C84-01304790A03E@gmail.com> <667D9EA8-F81D-475C-98F9-7A3E51628F91@metabang.com> Message-ID: Thank you for the quick action. It's great to see that you're actively maintaining the library :-) On Jun 20, 2008, at 9:37, Gary King wrote: > Daniel, > > Your patch went out last night. Thanks again. > > 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? >> >> >> _______________________________________________ >> 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 > > > > From gwking at metabang.com Sat Jun 21 13:06:13 2008 From: gwking at metabang.com (Gary King) Date: Sat, 21 Jun 2008 09:06:13 -0400 Subject: [cl-containers-devel] insert-new-item should apply key to item In-Reply-To: References: <690DAD6D-30D4-4DB9-8C84-01304790A03E@gmail.com> <667D9EA8-F81D-475C-98F9-7A3E51628F91@metabang.com> Message-ID: <62899DEB-0F32-46D4-AE6E-8AA96E3ABCEB@metabang.com> You're welcome. I just wish I had time to do more than just maintain... oh well. There's always the future! On Jun 21, 2008, at 7:08 AM, Daniel Dickison wrote: > Thank you for the quick action. It's great to see that you're > actively maintaining the library :-) > > > On Jun 20, 2008, at 9:37, Gary King wrote: > >> Daniel, >> >> Your patch went out last night. Thanks again. >> >> 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? >>> >>> >>> _______________________________________________ >>> 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 >> >> >> >> > _______________________________________________ > 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