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

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

Re: Easy to add with push but not to the end of a list


From: Emanuel Berg
Subject: Re: Easy to add with push but not to the end of a list
Date: Mon, 28 Nov 2022 23:58:27 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Stefan Monnier via Users list for the GNU Emacs text editor wrote:

> Add them in the reverse order and finish with a simple
> `reverse`. That's a very standard design pattern with
> singly-linked lists (and in many/most cases the final
> `reverse` can be an `nreverse`).

I thought about `nreverse' but if that changes all the CDRs
then that's linear as well i.e. O(n), otherwise you could do
nreverse, `push', and nreverse again ...

-- 
underground experts united
https://dataswamp.org/~incal




reply via email to

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