[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))
- 06/18: installer: Use _ instead of M_ for host-name-refresh., (continued)
- 06/18: installer: Use _ instead of M_ for host-name-refresh., John Darrington, 2017/02/02
- 14/18: gurses: Cache the windows of buttons., John Darrington, 2017/02/02
- 16/18: installer: New procedure key-value-slurp., John Darrington, 2017/02/02
- 18/18: installer: Fix bug when changing languages., John Darrington, 2017/02/02
- 07/18: installer: New page to select language., John Darrington, 2017/02/02
- 10/18: installer: Fix i18n in dialogs., John Darrington, 2017/02/02
- 17/18: installer: Provide verbose description of locale., John Darrington, 2017/02/02
- 03/18: installer: New file i18n.scm., John Darrington, 2017/02/02
- 11/18: installer: New convenience procedures., John Darrington, 2017/02/02
- 13/18: gurses: Avoid one use of car/cdr., John Darrington, 2017/02/02
- 15/18: gurses: Use match instead of car.,
John Darrington <=
- 12/18: installer: Improve i18n in ping page., John Darrington, 2017/02/02