unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* seq-some-p and nil
@ 2015-09-03 15:50 Simen Heggestøyl
  2015-09-03 16:42 ` Stefan Monnier
  2015-09-03 19:40 ` Nicolas Petton
  0 siblings, 2 replies; 54+ messages in thread
From: Simen Heggestøyl @ 2015-09-03 15:50 UTC (permalink / raw)
  To: nicolas; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 679 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 1130 bytes --]

^ permalink raw reply	[flat|nested] 54+ messages in thread

end of thread, other threads:[~2015-09-28 19:17 UTC | newest]

Thread overview: 54+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-03 15:50 seq-some-p and nil Simen Heggestøyl
2015-09-03 16:42 ` Stefan Monnier
2015-09-03 17:19   ` Artur Malabarba
2015-09-03 17:35     ` John Mastro
2015-09-03 17:50       ` Drew Adams
2015-09-03 19:36         ` Nicolas Petton
2015-09-03 19:45       ` Nicolas Petton
2015-09-06  1:17         ` Mark Oteiza
2015-09-06 20:48           ` Nicolas Petton
2015-09-06 21:46           ` Stefan Monnier
2015-09-07  6:11             ` Nicolas Petton
2015-09-07  8:06               ` Drew Adams
2015-09-07 15:19                 ` Stefan Monnier
2015-09-07 15:23                   ` Mark Oteiza
2015-09-07 17:08                   ` Drew Adams
2015-09-07 20:44                   ` Nicolas Petton
2015-09-07 22:27                     ` Stefan Monnier
2015-09-08  7:09                       ` Nicolas Petton
2015-09-08 12:36                         ` Stefan Monnier
2015-09-08 13:07                           ` Nicolas Petton
2015-09-08 16:49                             ` Stefan Monnier
2015-09-08 17:01                               ` David Kastrup
2015-09-08 17:08                                 ` Drew Adams
2015-09-08 19:02                                   ` Nicolas Petton
2015-09-08 19:48                                     ` Drew Adams
2015-09-09  7:56                                       ` Nicolas Petton
2015-09-09 13:26                                         ` Drew Adams
2015-09-09 17:45                                           ` Stefan Monnier
2015-09-09 17:53                                             ` Drew Adams
2015-09-09 20:24                                               ` Stefan Monnier
2015-09-09 20:46                                                 ` Drew Adams
2015-09-09 21:44                                           ` Nicolas Petton
2015-09-08 18:43                                 ` Stefan Monnier
2015-09-08 19:03                                   ` David Kastrup
2015-09-08 18:59                               ` Nicolas Petton
2015-09-08 19:06                                 ` David Kastrup
2015-09-08 20:33                                 ` Stefan Monnier
2015-09-09  7:57                                   ` Nicolas Petton
2015-09-08 13:21                           ` Nicolas Petton
2015-09-08 13:37                             ` Mark Oteiza
2015-09-08 17:50                               ` Stefan Monnier
2015-09-09  2:19                                 ` Mark Oteiza
2015-09-09  4:28                                   ` Stephen J. Turnbull
2015-09-09  4:57                                     ` Mark Oteiza
2015-09-07 20:45                   ` Nicolas Petton
2015-09-03 19:40 ` Nicolas Petton
2015-09-10 17:46   ` Simen Heggestøyl
2015-09-10 22:12     ` Nicolas Petton
2015-09-22 17:17       ` Simen Heggestøyl
2015-09-23  8:38         ` Nicolas Petton
2015-09-23  8:44           ` David Kastrup
2015-09-23  8:48           ` Simen Heggestøyl
2015-09-23 10:57             ` Nicolas Petton
2015-09-28 19:17         ` Nicolas Petton

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).