[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: |
Emanuel Berg |
Subject: |
Re: Testing whether a list contains at least one non-nil element |
Date: |
Tue, 25 Oct 2022 19:51:26 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Joost Kremers 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))
Nope, at least the way I understood the question where the
loop would continue at that position, but actually anyway
those are not as good as
(cl-position-if-not #'null '(nil nil)) ; nil
(cl-position-if-not #'null '(nil 2)) ; 1
--
underground experts united
https://dataswamp.org/~incal
- Re: [External] : Re: Testing whether a list contains at least one non-nil element, (continued)
Re: Testing whether a list contains at least one non-nil element, Emanuel Berg, 2022/10/26
Re: Testing whether a list contains at least one non-nil element, Joost Kremers, 2022/10/25
Re: Testing whether a list contains at least one non-nil element, Joost Kremers, 2022/10/25
Re: Testing whether a list contains at least one non-nil element,
Emanuel Berg <=