From: Richard W. M. J. <ri...@me...> - 2005-11-24 16:09:49
|
On Thu, Nov 24, 2005 at 03:56:20PM +0000, Amit Dubey wrote: > > Array.filter > > > Array.find_all > > > Array.partition > > > > > > Would these return lists or arrays? > > > > I think it's better to return arrays, but what do people think about > > that? > > Actually, I agree it makes complete sense for partition. As I think about > it, I think filter and find_all should be different. find_all should return > a list, and filter should return an array. And possibly, filter should be > defined in terms of find_all. Perhaps you can share your thinking on this :-) I think the principle of least surprise is going to be that Array.filter should return an array - this is surely what users would expect. The problem will be in the implementation which may require two passes -- it could be solved better if there was a truncation primitive for arrays. Rich. -- Richard Jones, CTO Merjis Ltd. Merjis - web marketing and technology - http://merjis.com Team Notepad - intranets and extranets for business - http://team-notepad.com |