bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#21782: 25.0.50; New functions nfront/front


From: Michael Heerdegen
Subject: bug#21782: 25.0.50; New functions nfront/front
Date: Fri, 30 Oct 2015 15:09:10 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

"Constantino Calancha" <f92capac@gmail.com> writes:

> Im sorry Michael, but i dont see your point: do you mean the fact to
> call nreverse twice?  nreverse is in fact very efficient; and last
> already use nthcdr in its implementation.

`nreverse` efficiently does what is supposed to do, yes.  But it is
O(l), where l is the length of the list arg.

In addition, the newly created `nreverse'd list must be garbage
collected.

The `copy-sequence' call in `front' is bad for the same reason.

OTOH nfront can be implemented in O(n), where n is the number argument
to nfront.


Michael.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]