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

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

Re: Testing whether a list contains at least one non-nil element


From: Heime
Subject: Re: Testing whether a list contains at least one non-nil element
Date: Tue, 25 Oct 2022 19:44:55 +0000





Sent with Proton Mail secure email.

------- Original Message -------
On Tuesday, October 25th, 2022 at 5:25 PM, Joost Kremers 
<joostkremers@fastmail.fm> wrote:


> On Tue, Oct 25 2022, Heime wrote:
> 
> > I would like to test whether a list contains at least one non-nil element? 
> > If I do that, then
> > I would be able to continue a loop where a non-nil element would mean that 
> > a match was found.
> 
> 
> (seq-some (lambda (e) (not (null e))) mylist)
> 
> or shorter:
> 
> (not (seq-every-p #'null mylist))

How does your implementation (not (seq-every-p #'null mylist)) compared to 

(elt (delq nil mylist) 0) 





reply via email to

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