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

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

Re: [External] : Re: Testing whether a list contains at least one non-ni


From: Stefan Monnier
Subject: Re: [External] : Re: Testing whether a list contains at least one non-nil element
Date: Tue, 25 Oct 2022 23:00:21 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

> (benchmark 100000 '(let ((mylist (list nil nil nil nil nil nil nil nil nil 
> t)))
>                      (elt (delq nil mylist) 0)))

The `elt` call is unnecessary.
And to avoid the destructiveness of `delq` you can use `remq`.


        Stefan




reply via email to

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