GNU bug report logs - #34852
26.1; seq-intersection ignores nil as element

Previous Next

Package: emacs;

Reported by: "Miguel V. S. Frasson" <mvsfrasson <at> gmail.com>

Date: Thu, 14 Mar 2019 02:24:01 UTC

Severity: normal

Tags: fixed

Found in version 26.1

Fixed in version 27.1

Done: Nicolas Petton <nicolas <at> petton.fr>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: Nicolas Petton <nicolas <at> petton.fr>
Cc: "Basil L. Contovounesios" <contovob <at> tcd.ie>, 34852 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>, "Miguel V. S. Frasson" <mvsfrasson <at> gmail.com>
Subject: bug#34852: 26.1; seq-intersection ignores nil as element
Date: Wed, 20 Mar 2019 23:33:18 +0100
Nicolas Petton <nicolas <at> petton.fr> writes:

> +(cl-defgeneric seq-contains-p (sequence elt &optional testfn)
> +  "Return non-nil if SEQUENCE contains an element equal to ELT.
> +Equality is defined by TESTFN if non-nil or by `equal' if nil."
> +    (catch 'seq--break
> +      (seq-doseq (e sequence)
> +        (when (funcall (or testfn #'equal) e elt)
> +          (throw 'seq--break t)))
> +      nil))

A detail: could you factor out the result of (or testfn #'equal) so that
`or' is not called repeatedly in the loop?

Michael.




This bug report was last modified 6 years and 64 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.