[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
seq-some-p and nil
From: |
Simen Heggestøyl |
Subject: |
seq-some-p and nil |
Date: |
Thu, 03 Sep 2015 17:50:29 +0200 |
Hi!
Currently it's not possible to use `seq-some-p' to check if a sequence
contains some `nil' value. For instance:
(seq-some-p #'null '(1 2))
⇒ nil
Which is good, but:
(seq-some-p #'null '(1 nil 2))
⇒ nil
How to distinguish the two cases?
Two solutions come to my mind: 1) Make `seq-some-p' a pure t/nil
predicate, or 2) Make it behave like `some' in Common Lisp, which is
to return the first non-nil value which is returned by an invocation
of the predicate. So in CL:
(some #'null '(1 2))
⇒ nil
And:
(some #'null '(1 nil 2))
⇒ t
And even:
(some #'1+ '(5 4 3))
⇒ 6
What do you think?
-- Simen
- seq-some-p and nil,
Simen Heggestøyl <=
- Re: seq-some-p and nil, Stefan Monnier, 2015/09/03
- Re: seq-some-p and nil, Artur Malabarba, 2015/09/03
- Re: seq-some-p and nil, Nicolas Petton, 2015/09/03
- Re: seq-some-p and nil, Mark Oteiza, 2015/09/05
- Re: seq-some-p and nil, Nicolas Petton, 2015/09/06
- Re: seq-some-p and nil, Stefan Monnier, 2015/09/06
- Re: seq-some-p and nil, Nicolas Petton, 2015/09/07