emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

feature/native-comp 3062480 1/4: * lisp/emacs-lisp/comp-cstr.el (comp-no


From: Andrea Corallo
Subject: feature/native-comp 3062480 1/4: * lisp/emacs-lisp/comp-cstr.el (comp-normalize-valset): Remove duplicates.
Date: Tue, 13 Apr 2021 06:11:48 -0400 (EDT)

branch: feature/native-comp
commit 3062480309b0d3bd66370265ed1a1dc79b6edeed
Author: Andrea Corallo <akrl@sdf.org>
Commit: Andrea Corallo <akrl@sdf.org>

    * lisp/emacs-lisp/comp-cstr.el (comp-normalize-valset): Remove duplicates.
---
 lisp/emacs-lisp/comp-cstr.el | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/lisp/emacs-lisp/comp-cstr.el b/lisp/emacs-lisp/comp-cstr.el
index 7f5d34b..b2d34af 100644
--- a/lisp/emacs-lisp/comp-cstr.el
+++ b/lisp/emacs-lisp/comp-cstr.el
@@ -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."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]