[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: seq-some-p and nil
From: |
Mark Oteiza |
Subject: |
Re: seq-some-p and nil |
Date: |
Tue, 8 Sep 2015 22:19:59 -0400 |
User-agent: |
Mutt/1.5.24+9 (2dac9fa02842) (2015-08-30) |
On 08/09/15 at 01:50pm, Stefan Monnier wrote:
> > (defun seq-some (pred seq)
> > (funcall pred (seq-find (pred seq)))
>
> But that fails for the case where the element found is nil.
Works as expected
(cl-defgeneric seq-find (pred seq)
(catch 'seq--break
(seq-doseq (elt seq)
(when (funcall pred elt)
(throw 'seq--break elt)))
nil))
(cl-defgeneric seq-some (pred seq)
(funcall pred (seq-find pred seq)))
(seq-find 'null [1 2 nil])
;; => nil
(seq-some 'null [1 2 nil])
;; => t
It's not a "semantic problem" or a "corner case", if one is really
curious if their sequence has a nil value, seq-find isn't the way to
find out.
- RE: seq-some-p and nil, (continued)
- Re: seq-some-p and nil, Nicolas Petton, 2015/09/08
- Re: seq-some-p and nil, David Kastrup, 2015/09/08
- Re: seq-some-p and nil, Stefan Monnier, 2015/09/08
- Re: seq-some-p and nil, Nicolas Petton, 2015/09/09
- Re: seq-some-p and nil, Nicolas Petton, 2015/09/08
- Re: seq-some-p and nil, Mark Oteiza, 2015/09/08
- Re: seq-some-p and nil, Stefan Monnier, 2015/09/08
- Re: seq-some-p and nil,
Mark Oteiza <=
- Re: seq-some-p and nil, Stephen J. Turnbull, 2015/09/09
- Re: seq-some-p and nil, Mark Oteiza, 2015/09/09
- Re: seq-some-p and nil, Nicolas Petton, 2015/09/07
Re: seq-some-p and nil, Nicolas Petton, 2015/09/03
- Re: seq-some-p and nil, Simen Heggestøyl, 2015/09/10
- Re: seq-some-p and nil, Nicolas Petton, 2015/09/10
- Re: seq-some-p and nil, Simen Heggestøyl, 2015/09/22
- Re: seq-some-p and nil, Nicolas Petton, 2015/09/23
- Re: seq-some-p and nil, David Kastrup, 2015/09/23
- Re: seq-some-p and nil, Simen Heggestøyl, 2015/09/23