dannym pushed a commit to branch wip-installer-2
in repository guix.
commit 7befec24b641ca9fdec675f08bca566f506ace6e
Author: John Darrington <[email protected]>
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))