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

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

[elpa] externals/gnugo 0b08017 114/357: [gnugo int] Avoid double list-re


From: Stefan Monnier
Subject: [elpa] externals/gnugo 0b08017 114/357: [gnugo int] Avoid double list-reverse.
Date: Sun, 29 Nov 2020 14:51:01 -0500 (EST)

branch: externals/gnugo
commit 0b080172ecb11f9c3dd6f9aadd0bd632ac326236
Author: Thien-Thi Nguyen <ttn@gnu.org>
Commit: Thien-Thi Nguyen <ttn@gnu.org>

    [gnugo int] Avoid double list-reverse.
    
    * packages/gnugo/gnugo.el (gnugo-describe-internal-properties):
    Use ‘do (push ...)’ instead of ‘collect’ in ‘loop’;
    don't ‘reverse’ the result later.
---
 gnugo.el | 36 +++++++++++++++++++-----------------
 1 file changed, 19 insertions(+), 17 deletions(-)

diff --git a/gnugo.el b/gnugo.el
index a097075..d061fde 100644
--- a/gnugo.el
+++ b/gnugo.el
@@ -250,22 +250,24 @@ Handle the big, slow-to-render, and/or uninteresting ones 
specially."
   (interactive)
   (let ((buf (current-buffer))
         (d (gnugo-get :diamond))
-        (acc (loop for key being the hash-keys of gnugo-state
-                   using (hash-values val)
-                   collect (cons key
-                                 (case key
-                                   ((:xpms :local-xpms)
-                                    (format "hash: %X (%d images)"
-                                            (sxhash val)
-                                            (length val)))
-                                   (:sgf-collection
-                                    (length val))
-                                   (:monkey
-                                    (let ((mem (aref val 0)))
-                                      (list (aref val 1)
-                                            (aref val 2)
-                                            (car mem))))
-                                   (t val))))))
+        acc)
+    (loop for key being the hash-keys of gnugo-state
+          using (hash-values val)
+          do (push (cons key
+                         (case key
+                           ((:xpms :local-xpms)
+                            (format "hash: %X (%d images)"
+                                    (sxhash val)
+                                    (length val)))
+                           (:sgf-collection
+                            (length val))
+                           (:monkey
+                            (let ((mem (aref val 0)))
+                              (list (aref val 1)
+                                    (aref val 2)
+                                    (car mem))))
+                           (t val)))
+                   acc))
     (switch-to-buffer (get-buffer-create
                        (format "%s*GNUGO Board Properties*"
                                (gnugo-get :diamond))))
@@ -273,7 +275,7 @@ Handle the big, slow-to-render, and/or uninteresting ones 
specially."
     (emacs-lisp-mode)
     (setq truncate-lines t)
     (save-excursion
-      (pp (reverse acc)
+      (pp acc
           (current-buffer))
       (goto-char (point-min))
       (let ((rx (format "overlay from \\([0-9]+\\).+\n%s\\s-+"



reply via email to

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