emacs-devel
[Top][All Lists]
Advanced

[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

reply via email to

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