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: Joost Kremers
Subject: Re: Testing whether a list contains at least one non-nil element
Date: Tue, 25 Oct 2022 19:25:21 +0200
User-agent: mu4e 1.8.3; emacs 28.1.91

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))

If you use dash.el, there's also --any? (or --any-p if you prefer):

(--any? (not (null it)) mylist)

HTH

-- 
Joost Kremers
Life has its moments



reply via email to

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