From: Brian H. <bh...@sp...> - 2003-03-17 15:56:42
|
On Mon, 17 Mar 2003, fva wrote: > Rather than using ExtList which gives the impression of an extension of > the signature (maybe there is, I haven't looked into the code, really) The only extension to the list signature I made was that I added a fold_right'. The only way I could think of to implement fold_right in a tail-recursive manner was to first reverse the list, and then traverse it. My experiments with append show that reversing the list is about 30% slower than simply doing a non-tail recursion. So I provided two functions- fold_right which reverse the list (works correctly for all lists, slower), and fold_right' which does non-tail-recursion (faster, doesn't work for all lists). Brian |