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

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

[elpa] externals/gnugo 0c7bc82 025/357: [gnugo int] Use cl-{plus, minus}


From: Stefan Monnier
Subject: [elpa] externals/gnugo 0c7bc82 025/357: [gnugo int] Use cl-{plus, minus}p more.
Date: Sun, 29 Nov 2020 14:50:40 -0500 (EST)

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

    [gnugo int] Use cl-{plus,minus}p more.
    
    * packages/gnugo/gnugo.el (gnugo-merge-showboard-results)
    (gnugo-venerate, gnugo-refresh, gnugo-magic-undo)
    (gnugo-board-mode, gnugo, GTP undo, GTP gg-undo):
    Use ‘cl-plusp’ and ‘cl-minusp’ instead of comparison against 0.
---
 gnugo.el | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/gnugo.el b/gnugo.el
index 12b7e88..5673360 100644
--- a/gnugo.el
+++ b/gnugo.el
@@ -539,7 +539,7 @@ a format string applied to the rest of the args."
     (while (numberp (setq mis (compare-strings bef bef-start nil
                                                aft aft-start nil)))
       (setq aft-sync-backtrack nil
-            inc (if (> 0 mis)
+            inc (if (cl-minusp mis)
                     (- (+ 1 mis))
                   (- mis 1))
             bef-idx (+ bef-start inc)
@@ -733,7 +733,8 @@ For all other values of RSEL, do nothing and return nil."
                         (when (string-match "\\([0-9]+\\)\\s-+[0-9]+\"," s)
                           (setq start (match-end 0))
                           (string-to-number (match-string 1 s)))))
-                  (while (and (<= 0 ncolors) (string-match ",\n" s start))
+                  (while (and (not (cl-minusp ncolors))
+                              (string-match ",\n" s start))
                     (setq start (match-end 0)
                           ncolors (1- ncolors)))
                   (string-match "\"" s start)
@@ -745,7 +746,7 @@ For all other values of RSEL, do nothing and return nil."
          (color-key (aref new sx)))     ; blech, heuristic
     (while (< sx lx)
       (when (and (not (= color-key (aref new sx)))
-                 (< 0 (random 4)))
+                 (cl-plusp (random 4)))
         (aset new sx (aref bg-data sb)))
       (incf sx)
       (incf sb))
@@ -860,7 +861,7 @@ its move."
                           (if under10p 2 4)
                         0))
                    2.0)))
-        (dolist (pair `((tpad . ,(if (and h (< 0 h))
+        (dolist (pair `((tpad . ,(if (and h (cl-plusp h))
                                      `(display ,(make-string h 10))
                                    '(invisible :nogrid)))
                         (gpad . (display
@@ -1303,7 +1304,7 @@ turn to play.  Optional second arg NOALT non-nil inhibits 
this."
          (mem (aref monkey 1))
          (count (aref monkey 2))
          done ans)
-    (cond ((and (numberp spec) (< 0 spec))
+    (cond ((and (numberp spec) (cl-plusp spec))
            (setq n spec done (lambda () (zerop n))))
           ((string-match "^[a-z]" spec)
            (let ((pos (upcase spec)))
@@ -1626,8 +1627,8 @@ In this mode, keys do not self insert.  Default 
keybindings:
                         (h (or (car gnugo-option-history) "")))
                     (when (string-match "--mode" o)
                       (error "Found \"--mode\" in `gnugo-program'"))
-                    (when (and o (< 0 (length o))
-                               h (< 0 (length o))
+                    (when (and o (cl-plusp (length o))
+                               h (cl-plusp (length o))
                                (or (< (length h) (length o))
                                    (not (string= (substring h 0 (length o))
                                                  o))))
@@ -1736,7 +1737,7 @@ starting a new one.  See `gnugo-board-mode' documentation 
for more info."
                 acc))
          (n (length all)))
     (if (and (not new-game)
-             (< 0 n)
+             (cl-plusp n)
              (y-or-n-p (format "GNU Go game%s in progress, resume play? "
                                (if (= 1 n) "" "s"))))
         ;; resume
@@ -1887,7 +1888,7 @@ starting a new one.  See `gnugo-board-mode' documentation 
for more info."
       (lambda (sel) (gnugo-magic-undo
                      (let (n)
                        (cond ((not sel) 1)
-                             ((< 0 (setq n (string-to-number (car sel)))) n)
+                             ((cl-plusp (setq n (string-to-number (car sel)))) 
n)
                              (t (car sel)))))))))
 
 (provide 'gnugo)



reply via email to

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