[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: behaviour change in cl-subseq
From: |
Artur Malabarba |
Subject: |
Re: behaviour change in cl-subseq |
Date: |
Fri, 21 Aug 2015 01:02:18 +0100 |
> (defun seq-contains-p (seq elt &optional testfn)
> "Return the first element in SEQ that equals to ELT.
> Equality is defined by TESTFN if non-nil or by `equal' if nil."
> (seq-some-p (lambda (e)
> (funcall (or testfn #'equal) elt e))
> seq))
>
> Two issues. Implementation wise, you are depending on behaviour outside
> the interface of seq-some-p which says....
>
> "Return any element for which (PRED element) is non-nil in SEQ, nil
> otherwise."
>
> The other option is to add a `seq-contains-nil-p' function.
>
> Personally, I'd change seq-contains-p. Better to break the interface of
> seq-contains-p earlier rather than later.
I think both functions need to change behavior. They are named as
`-p', but "return an element" is not the behavior of a boolean
predicate (precisely because of the situation you describe).
IMO, the current behavior of `seq-some-p' should be called `seq-some'.
And the same for `seq-contains'.
- Re: behaviour change in cl-subseq, (continued)
- Re: behaviour change in cl-subseq, Tassilo Horn, 2015/08/06
- Re: behaviour change in cl-subseq, Phillip Lord, 2015/08/06
- Re: behaviour change in cl-subseq, Leo Liu, 2015/08/06
- Re: behaviour change in cl-subseq, Phillip Lord, 2015/08/07
- Re: behaviour change in cl-subseq, Nicolas Petton, 2015/08/07
- Re: behaviour change in cl-subseq, Phillip Lord, 2015/08/07
- Re: behaviour change in cl-subseq, Nicolas Petton, 2015/08/07
- Re: behaviour change in cl-subseq, Phillip Lord, 2015/08/07
- Re: behaviour change in cl-subseq, Nicolas Petton, 2015/08/08
- Re: behaviour change in cl-subseq, Phillip Lord, 2015/08/20
- Re: behaviour change in cl-subseq,
Artur Malabarba <=
Re: behaviour change in cl-subseq, Nicolas Petton, 2015/08/06