From: Brian H. <bh...@sp...> - 2003-03-11 19:35:39
|
OK, The first of three libraries I'm submitting for comments: XList. XList is a reimplementation of the Ocaml standard List library, except all non-tail recursion has been removed, and instead I use Olivier Andrieu's setcdr function. This should be as fast as recursion for short lists, but work correctly (shouldn't blow stack) for long lists. Well, for everything except two functions: fold_right and fold_right2. For these two functions I did the reverse-the-list-first trick. As this is slower than recursion for short lists, I also added fold_right' and fold_right2' which use non-tail recursion if it's important. Brian |