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

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

[elpa] externals/gnugo 28da1b4 035/357: [gnugo int] Use ‘dolist’ and ‘d


From: Stefan Monnier
Subject: [elpa] externals/gnugo 28da1b4 035/357: [gnugo int] Use ‘dolist’ and ‘destructuring-bind’.
Date: Sun, 29 Nov 2020 14:50:42 -0500 (EST)

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

    [gnugo int] Use ‘dolist’ and ‘destructuring-bind’.
    
    * packages/gnugo/gnugo.el (gnugo-board-mode): ...here,
    instead of ‘mapc’ and ‘apply (lambda () ...)’.
---
 gnugo.el | 30 ++++++++++++++----------------
 1 file changed, 14 insertions(+), 16 deletions(-)

diff --git a/gnugo.el b/gnugo.el
index 1d5d5a5..340c46e 100644
--- a/gnugo.el
+++ b/gnugo.el
@@ -1692,22 +1692,20 @@ In this mode, keys do not self insert.  Default 
keybindings:
                            'gnugo-option-history))
         (rules "Japanese")
         board-size user-color handicap komi minus-l infile)
-    (mapc (lambda (x)
-            (apply (lambda (var default opt &optional rx)
-                     (set var
-                          (or (when (string-match opt args)
-                                (let ((start (match-end 0)) s)
-                                  (string-match (or rx "[0-9.]+") args start)
-                                  (setq s (match-string 0 args))
-                                  (if rx s (string-to-number s))))
-                              default)))
-                   x))
-          '((board-size      19 "--boardsize")
-            (user-color "black" "--color" "\\(black\\|white\\)")
-            (handicap         0 "--handicap")
-            (komi           0.0 "--komi")
-            (minus-l        nil "\\([^-]\\|^\\)-l[ ]*" "[^ ]+")
-            (infile         nil "--infile" "[ ]*[^ ]+")))
+    (dolist (x '((board-size      19 "--boardsize")
+                 (user-color "black" "--color" "\\(black\\|white\\)")
+                 (handicap         0 "--handicap")
+                 (komi           0.0 "--komi")
+                 (minus-l        nil "\\([^-]\\|^\\)-l[ ]*" "[^ ]+")
+                 (infile         nil "--infile" "[ ]*[^ ]+")))
+      (destructuring-bind (var default opt &optional rx) x
+        (set var
+             (or (when (string-match opt args)
+                   (let ((start (match-end 0)) s)
+                     (string-match (or rx "[0-9.]+") args start)
+                     (setq s (match-string 0 args))
+                     (if rx s (string-to-number s))))
+                 default))))
     (gnugo-put :user-color user-color)
     (when (string-match "--chinese-rules" args)
       (setq rules "Chinese"))



reply via email to

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