From nathan at acceleration.net Fri Mar 6 17:10:10 2009 From: nathan at acceleration.net (Nathan Bird) Date: Fri, 06 Mar 2009 12:10:10 -0500 Subject: [cl-containers-devel] darcs patch: When searching for an item in a bst, make sure that th... Message-ID: Fri Mar 6 11:52:50 EST 2009 Nathan Bird * When searching for an item in a bst, make sure that the node isn't a placeholder and actually has an element -------------- next part -------------- A non-text attachment was scrubbed... Name: when-searching-for-an-item-in-a-bst_-make-sure-that-the-node-isn_t-a-placeholder-and-actually-has-an-element.dpatch Type: text/x-darcs-patch Size: 428 bytes Desc: A darcs patch for your repository! URL: From nathan at acceleration.net Fri Mar 6 19:51:43 2009 From: nathan at acceleration.net (Nathan Bird) Date: Fri, 06 Mar 2009 14:51:43 -0500 Subject: [cl-containers-devel] darcs patch: When searching for an item in a bst, make sure that th... In-Reply-To: References: Message-ID: <49B17ECF.6030605@acceleration.net> On 3/6/2009 12:10 PM, Nathan Bird wrote: > Fri Mar 6 11:52:50 EST 2009 Nathan Bird > * When searching for an item in a bst, make sure that the node isn't a placeholder and actually has an element > The point of this is that because the red black tree has empty nodes as placeholders we need to test for that. Without this searching a red black tree for an element it doesn't contain doesn't return null, but errors. > (containers:item-at (containers:make-container 'containers:red-black-tree) 1) Alternatively to testing the element slot directly, there appears to be a node-empty-p function that might be more appropriate. From gwking at metabang.com Fri Mar 6 22:03:58 2009 From: gwking at metabang.com (Gary King) Date: Fri, 6 Mar 2009 17:03:58 -0500 Subject: [cl-containers-devel] darcs patch: When searching for an item in a bst, make sure that th... In-Reply-To: <49B17ECF.6030605@acceleration.net> References: <49B17ECF.6030605@acceleration.net> Message-ID: <4F11F459-895E-4209-8098-3008EBA76E15@metabang.com> Thanks Nathan, I'll look try at this over the weekend. On Mar 6, 2009, at 2:51 PM, Nathan Bird wrote: > On 3/6/2009 12:10 PM, Nathan Bird wrote: >> Fri Mar 6 11:52:50 EST 2009 Nathan Bird >> * When searching for an item in a bst, make sure that the node >> isn't a placeholder and actually has an element >> > The point of this is that because the red black tree has empty nodes > as > placeholders we need to test for that. Without this searching a red > black tree for an element it doesn't contain doesn't return null, but > errors. > >> (containers:item-at (containers:make-container > 'containers:red-black-tree) 1) > > Alternatively to testing the element slot directly, there appears to > be > a node-empty-p function that might be more appropriate. > > _______________________________________________ > 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 * gwking on twitter From nathan at acceleration.net Sat Mar 7 19:16:35 2009 From: nathan at acceleration.net (Nathan Bird) Date: Sat, 07 Mar 2009 14:16:35 -0500 Subject: [cl-containers-devel] darcs patch: When searching for an item in a bst, make sure that th... In-Reply-To: <4F11F459-895E-4209-8098-3008EBA76E15@metabang.com> References: <49B17ECF.6030605@acceleration.net> <4F11F459-895E-4209-8098-3008EBA76E15@metabang.com> Message-ID: <49B2C813.8050505@acceleration.net> On 3/6/2009 5:03 PM, Gary King wrote: > Thanks Nathan, > > I'll look try at this over the weekend. > > > On Mar 6, 2009, at 2:51 PM, Nathan Bird wrote: > >> On 3/6/2009 12:10 PM, Nathan Bird wrote: >>> Fri Mar 6 11:52:50 EST 2009 Nathan Bird >>> * When searching for an item in a bst, make sure that the node >>> isn't a placeholder and actually has an element >>> >> The point of this is that because the red black tree has empty nodes as >> placeholders we need to test for that. Without this searching a red >> black tree for an element it doesn't contain doesn't return null, but >> errors. >> >>> (containers:item-at (containers:make-container >> 'containers:red-black-tree) 1) >> >> Alternatively to testing the element slot directly, there appears to be >> a node-empty-p function that might be more appropriate. I made a patch that uses the node-empty-p function instead, as well as a patch that adds a bunch of tests on the red-black and binary-search trees. Removed the tests/misc.lisp file in which all the code was commented out; what was in there is now one of the tests in trees.lisp (fixed up a bit). -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: trees.dpatch URL: