emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/xr 69522c3 3/5: Use dolist instead of mapc with lambda


From: Mattias Engdegård
Subject: [elpa] externals/xr 69522c3 3/5: Use dolist instead of mapc with lambda
Date: Sun, 26 May 2019 13:17:53 -0400 (EDT)

branch: externals/xr
commit 69522c347c84ce44b24556f018fdbb8d220d591b
Author: Mattias Engdegård <address@hidden>
Commit: Mattias Engdegård <address@hidden>

    Use dolist instead of mapc with lambda
    
    It's more readable and slightly faster.
---
 xr.el | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/xr.el b/xr.el
index f8e484e..f9067d7 100644
--- a/xr.el
+++ b/xr.el
@@ -258,12 +258,11 @@
       ;; wrote it that way, there was probably a reason for it.
       (let ((ranges nil)
             (chars nil))
-        (mapc (lambda (interv)
-                (if (eq (aref interv 0) (aref interv 1))
-                    (push (aref interv 0) chars)
-                  (push (string (aref interv 0) ?- (aref interv 1))
-                        ranges)))
-              sorted)
+        (dolist (interv sorted)
+          (if (eq (aref interv 0) (aref interv 1))
+              (push (aref interv 0) chars)
+            (push (string (aref interv 0) ?- (aref interv 1))
+                  ranges)))
         
         ;; Note that we return (any) for non-negated empty sets,
         ;; such as [z-a]. (any) is not accepted by rx but at least we
@@ -1081,11 +1080,10 @@ single-character strings."
      (t
       (let ((intervals nil)
             (chars nil))
-        (mapc (lambda (range)
-                (if (eq (car range) (cdr range))
-                    (push (car range) chars)
-                  (push (string (car range) ?- (cdr range)) intervals)))
-              ranges)
+        (dolist (range ranges)
+          (if (eq (car range) (cdr range))
+              (push (car range) chars)
+            (push (string (car range) ?- (cdr range)) intervals)))
         ;; Put a single `-' last.
         (when (memq ?- chars)
           (setq chars (append (delq ?- chars) (list ?-))))



reply via email to

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