guix-commits
[Top][All Lists]
Advanced

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

15/18: gurses: Use match instead of car.


From: John Darrington
Subject: 15/18: gurses: Use match instead of car.
Date: Thu, 2 Feb 2017 18:13:05 +0000 (UTC)

jmd pushed a commit to branch wip-installer
in repository guix.

commit 84b64010899210300707a81993f7372d44c56c90
Author: John Darrington <address@hidden>
Date:   Wed Feb 1 17:40:40 2017 +0100

    gurses: Use match instead of car.
    
    * gurses/buttons.scm (buttons-fetch-by-key): Remove car/cdr and use match.
---
 gurses/buttons.scm |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/gurses/buttons.scm b/gurses/buttons.scm
index a91b01f..76b637a 100644
--- a/gurses/buttons.scm
+++ b/gurses/buttons.scm
@@ -27,7 +27,6 @@
   #:export (buttons-selected)
   #:export (buttons-fetch-by-key)
   #:export (buttons-n-buttons)
-  #:export (buttons-get-current-selection)
   #:export (buttons-key-matches-symbol?)
 
   #:use-module (ncurses curses)
@@ -75,10 +74,10 @@
             (key #f))
     (if (or key (not (array-in-bounds? (buttons-array buttons) idx)))
        key
-       (let* ((k (array-ref (buttons-array buttons) idx))
-              (kk (list-ref k 2)))
-         (loop (1+ idx) (if (eq? (car k) c) kk #f))))))
-
+        (loop (1+ idx)
+              (match (array-ref (buttons-array buttons) idx)
+                     ((ch win sym)
+                      (if (eq? ch c) sym #f)))))))
 
 (define (buttons-select buttons which)
   (let ((arry (buttons-array buttons))



reply via email to

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