Re: [Newbies] How to empty a collection?
My understanding as well is that this is the purpose of #become:, but also that it is not very efficient in some versions of Smalltalk. If you are using an OrderedCollection, this is probably a reasonably efficient method as it doesn't need to search through the whole list every time it removes an element: removeAll [self notEmpty] whileTrue: [self removeLast] Brian. On Feb 18, 2008 6:42 PM, Marcin Tustin [EMAIL PROTECTED] wrote: My own testing suggests that references to the object remain in place. I would guess that that is the whole point of become. On Feb 19, 2008 1:38 AM, cdrick [EMAIL PROTECTED] wrote: Isn't Cedrick's aida solution going to be significantly faster? this is not mine :) butI'd interested to see if it's a good use of #become:... Does it keep references ? is it safe ? Thanks ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] How to empty a collection?
My understanding as well is that this is the purpose of #become:, but also that it is not very efficient in some versions of Smalltalk. If you are using an OrderedCollection, this is probably a reasonably efficient method as it doesn't need to search through the whole list every time it removes an element: removeAll [self notEmpty] whileTrue: [self removeLast] Brian. On Feb 18, 2008 6:42 PM, Marcin Tustin [EMAIL PROTECTED] wrote: My own testing suggests that references to the object remain in place. I would guess that that is the whole point of become. On Feb 19, 2008 1:38 AM, cdrick [EMAIL PROTECTED] wrote: Isn't Cedrick's aida solution going to be significantly faster? this is not mine :) butI'd interested to see if it's a good use of #become:... Does it keep references ? is it safe ? Thanks ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners