From: fva <fv...@ts...> - 2003-03-20 15:35:57
|
Brian Hurt wrote: >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). > Uh? You mean to put both in or you're just asking advice as to what we think about it? - If the former... I'd say one of them would never get used (probably) fold_right' because it is somewhat alien to the rest of the interfacing conventions. - If the latter... I'd say keep the one that you think works best (perhaps the less easily programmable, so that people who are dissatisfied with the behaviour can code their own and use it instead). I think you should have the freedom to supply any of them: you're the contributing author. Regards, Fran |