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

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

[elpa] 35/51: [gnugo int] Use ‘dolis t’ and ‘destructuring-bind’.


From: Thien-Thi Nguyen
Subject: [elpa] 35/51: [gnugo int] Use ‘dolis t’ and ‘destructuring-bind’.
Date: Mon, 24 Feb 2014 12:30:24 +0000

ttn pushed a commit to branch master
in repository elpa.

commit 965d606373deedecdd1ed43e01dae9a3ad6bbba2
Author: Thien-Thi Nguyen <address@hidden>
Date:   Sat Feb 15 12:07:42 2014 +0100

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

diff --git a/packages/gnugo/gnugo.el b/packages/gnugo/gnugo.el
index 1d5d5a5..340c46e 100644
--- a/packages/gnugo/gnugo.el
+++ b/packages/gnugo/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]