From: Brian H. <bri...@ql...> - 2003-06-16 21:01:15
|
On Mon, 16 Jun 2003, Alan Post wrote: > In article <Pin...@ea...>, Brian Hurt wrote: > > > > With fold_right, it's impossible - so the question becomes which version > > do people want- slow and broken for long lists, or glacial and correct for > > all lists? Or some tricky version which picks between them? I've come to > > dislike my tricky version for reasons quite apart from performance. > > Why not simply provide "fold" which does a fold_left, and put in a > comment that the user should reverse the list arg if she really wants > a fold_right? As you said, it isn't possible to walk a list > backwards, so why pretend? > The short answer is that the standard library provides a fold_right, rightly or wrongly. If we're angling to replace the standard libraries, we need to not break any code that depends on them. Adding functions is OK, deleting functions I'd approach with great trepidation. Brian |