Newsgroups: fa.caml
From: Xavier Leroy <Xavier.Le...@inria.fr>
Date: 1999/01/12
Subject: Re: Map is not tail recursive
> I've had a look at the List package and it seems that it is not properly No, it is not. Like many other functions on lists. > tail recursive. > Even more, for medium to large lists it exhausts the The solution using List.reverse has unacceptable run-time penalty. In > stack. I would suggest either recoding it as > [with List.reverse] > Another possibility would be to introduce destructive operations such as > Scheme's setcdr! and setcar!. This would eliminate the need of using > List.reverse, at the cost of introducing some imperative style. particular, it heap-allocates twice as much than the natural implementation. setcdr! for lists is not available in the language, since lists are Let me put this another way. There are some library functions for I would also contend that if your program routinely manipulate Regards, - Xavier Leroy You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||