From: Nicolas C. <war...@fr...> - 2003-04-22 01:56:58
|
> > It is called , it should actually be called when call - complexity is lower > > than O(n) since the overhead is not big. > > Which is never in list functions, that I know about. I was talking about complexity in term of numbers of calls to _setcdr. BTW, you're right, I'm not sure there is functions with only one call to _setcdr > I've yet to hear this in a case where it turned out to be so. This will need a very major changes in the entire Ocaml sources since it will involve modifying the current memory representation, and I'm pretty sure it won't happen before few years. > And I > notice the changes are sneaking out of ExtList- I note that Enum has an > Obj.magic call which is effectively _setcdr. On my to-do list was to take > a long hard look at Enum.force to see if I could move that _setcdr back > into ExtList where it belongs. From my point of view, the setcdr is a trick which should of course not be put in the interface extList.mli ( we agreed on that before ). And so if you want to use it in Enum, you have to rewrite it. This is a performance trick, since we could always build the list in the other way and then rev it, and a safe trick since we could instead use a non tail-rec call. As a performance trick , it should be inlined. As a safe trick, it shouldn't be shown to the user, and a _setcdr function shouldn't even exists :) Nicolas Cannasse |