]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/emacs-lisp/comp-cstr.el (comp-normalize-valset): Remove duplicates.
authorAndrea Corallo <akrl@sdf.org>
Mon, 12 Apr 2021 14:42:01 +0000 (16:42 +0200)
committerAndrea Corallo <akrl@sdf.org>
Tue, 13 Apr 2021 10:05:33 +0000 (12:05 +0200)
lisp/emacs-lisp/comp-cstr.el

index 7f5d34b45c3360a17209b998cc90393201d82d70..b2d34af66b416cad87a350a5d078a809e8b099de 100644 (file)
@@ -186,12 +186,14 @@ Return them as multiple value."
 ;;; Value handling.
 
 (defun comp-normalize-valset (valset)
-  "Sort VALSET and return it."
-  (cl-sort valset (lambda (x y)
-                    ;; We might want to use `sxhash-eql' for speed but
-                    ;; this is safer to keep tests stable.
-                    (< (sxhash-equal x)
-                       (sxhash-equal y)))))
+  "Sort and remove duplicates from VALSET then return it."
+  (cl-remove-duplicates
+   (cl-sort valset (lambda (x y)
+                     ;; We might want to use `sxhash-eql' for speed but
+                     ;; this is safer to keep tests stable.
+                     (< (sxhash-equal x)
+                       (sxhash-equal y))))
+   :test #'eq))
 
 (defun comp-union-valsets (&rest valsets)
   "Union values present into VALSETS."