"Miguel V. S. Frasson" writes: > seq-intersection skips nil as common element, so returns wrong result. > > Reproducing from emacs -Q: > > In *scratch* buffer, eval the expressions > > (progn > (require 'seq) > (seq-intersection '(1 2 nil) '(1 nil) 'eq)) > > -> (1) > > (seq-intersection '(1 2 nil) '(1 nil) 'equal) > > -> (1) > > Expected result in both cases: (1 nil) This is actually due to seq-contains returning the element found, rather than a boolean indicating whether the element was found: (seq-contains '(nil) nil) ; => nil The nature of seq-contains as a predicate-ish has been discussed in the past[1], and Stefan recently fixed a similar problem with map-contains-key[2]. [1]: https://lists.gnu.org/archive/html/emacs-devel/2016-07/msg01256.html [2]: * lisp/emacs-lisp/map.el: Make the functions generic 2018-12-11 17:54:13 -0500 https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=1691a51094d35ac4b2c311fa407c6b77eea7a105 One solution is to leave seq-contains as it is, and switch to using seq-position (or some new predicate) as a predicate instead. Another is to make seq-contains return a boolean instead of the needle found, which would be a backward-incompatible change similar to that for map-contains-key. I attach a patch for each of these respective solutions; WDYT? -- Basil