Subject: bug#59328: 29.0.50; `seq-keep' implementation only valid for lists

From: Stefan Kangas <[email-masked]>
Date: Fri, 25 Nov 2022 12:34:38 +0100

Michael Heerdegen <[email-masked]> writes:

> #+begin_src emacs-lisp
> (progn
>   (defvar gensym)
>   (let ((gensym (make-symbol "foo")))
>     (eval `(cl-defmethod seq-map (function (thing (head ,gensym)))
>              (append (list (car thing) (cadr thing)) (seq-map function (cddr thing))))
>           t)
>     (equal (list gensym nil 4 46)
>            (seq-keep (lambda (x) (and (integerp x) (* 2 x)))
>                      (list gensym nil 2 'x gensym 23)))))
> #+end_src
>
> returns t with my patch installed and nil else and works without relying
> on something external. I'm not sure if defining methods (for seq-map in
> this case) that are globally visible is allowed in tests, so I
> implemented the example above in a way that the change of the generic
> function is not visible from the outside (thus the "secret" gensym).

We allow things that are globally visible, yes, as that will only
affect testing sessions.  So I think dropping the gensym will be an
improvement.

> Would something like that be acceptable?

Makes sense to me.  Perhaps we should do something similar for other
seq.el tests.