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: Drew Adams
Subject: RE: [External] : Re: Testing whether a list contains at least one non-nil element
Date: Wed, 26 Oct 2022 15:39:16 +0000

> > (cl-member-if-not #'null toto)
> 
> Close
>   (cl-member-if-not #'null '(nil nil)) ; nil
>   (cl-member-if-not #'null '(nil 2))   ; (2)
> 
> But
>   (cl-position-if-not #'null '(nil nil)) ; nil
>   (cl-position-if-not #'null '(nil 2))   ; 1

The request was for a test of whether the input
list contains any non-nil elements.  Yes, both
`cl-member-if-not' and `cl-position-if-not' can
do that.  Or `cl-member-if' and `cl-position-if',
passing #'identity.

There are lots of ways to do it.



reply via email to

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