Martin Buchholz <martin(a)xemacs.org> writes:
Jan> Why not do that? We can also do away with the caller calling
Jan> Flength when the results are not needed. Then we would only
Jan> loop over the list once and in addition the size of the list we
Jan> can loop over is not limited by the stack size limit.
It's not obvious to me which implementation is faster.
But yours introduces additional stack-allocation in the `mapc' case.
I actually have plans for optimizing map* in a bigger way. The
basic idea is to avoid repeating computations for each function
invocation.
I think I had a patch that did that, but it was very non-general. In
fact, it was one of my first patches to XEmacs C sources. A kind
elderly lady persuaded me to give it up at the time. :-)