[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
144/197: gurses: Avoid one more use of car and cdr.
From: |
Danny Milosavljevic |
Subject: |
144/197: gurses: Avoid one more use of car and cdr. |
Date: |
Mon, 3 Jul 2017 20:37:15 -0400 (EDT) |
dannym pushed a commit to branch wip-installer-2
in repository guix.
commit de4bafdf5e59d71f08d8a599846ad9e128adeda0
Author: John Darrington <address@hidden>
Date: Fri Jan 27 09:03:56 2017 +0100
gurses: Avoid one more use of car and cdr.
* gurses/stexi.scm (count-words): Use match instead of car and cdr.
---
gurses/stexi.scm | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/gurses/stexi.scm b/gurses/stexi.scm
index 6174d73..cb383e8 100644
--- a/gurses/stexi.scm
+++ b/gurses/stexi.scm
@@ -166,12 +166,14 @@ string of length LEN"
(x 0)
(n 0)
(prev-white #t))
- (if (null? in)
- n
- (let ((white (xchar-blank? (car in))))
- (loop (cdr in) (1+ x) (if (and prev-white (not white))
- (1+ n)
- n) white)))))
+ (match
+ in
+ (() n)
+ ((first . rest)
+ (let ((white (xchar-blank? first)))
+ (loop rest (1+ x) (if (and prev-white (not white))
+ (1+ n)
+ n) white))))))
(let* ((underflow (- len (length str)))
(word-count (count-words str))
- 164/197: gurses: Use match instead of car., (continued)
- 164/197: gurses: Use match instead of car., Danny Milosavljevic, 2017/07/03
- 170/197: installer: Remove unused procedure., Danny Milosavljevic, 2017/07/03
- 152/197: installer: New file i18n.scm., Danny Milosavljevic, 2017/07/03
- 110/197: installer: Add an explanatory text to the main page., Danny Milosavljevic, 2017/07/03
- 120/197: gurses: Mini refactor., Danny Milosavljevic, 2017/07/03
- 124/197: gurses: Populate dropdown boxes in forms using a menu., Danny Milosavljevic, 2017/07/03
- 131/197: gurses: Use inverse instead of underline for field value area., Danny Milosavljevic, 2017/07/03
- 133/197: installer: Change livery., Danny Milosavljevic, 2017/07/03
- 146/197: gurses: Use match instead of car/cdr in line-split., Danny Milosavljevic, 2017/07/03
- 147/197: gurses: In paragraph-format avoid use of car and cdr., Danny Milosavljevic, 2017/07/03
- 144/197: gurses: Avoid one more use of car and cdr.,
Danny Milosavljevic <=
- 143/197: gurses: Add predicate to test if a complex char is blank., Danny Milosavljevic, 2017/07/03
- 149/197: gurses: Add new procedure "word-endings"., Danny Milosavljevic, 2017/07/03
- 155/197: installer: Use _ instead of M_ for host-name-refresh., Danny Milosavljevic, 2017/07/03
- 160/197: installer: New convenience procedures., Danny Milosavljevic, 2017/07/03
- 158/197: installer: Correct placement of gettext call., Danny Milosavljevic, 2017/07/03
- 163/197: gurses: Cache the windows of buttons., Danny Milosavljevic, 2017/07/03
- 172/197: gurses: Update the cursor position when posting the form., Danny Milosavljevic, 2017/07/03
- 165/197: installer: New procedure key-value-slurp., Danny Milosavljevic, 2017/07/03
- 175/197: gurses: Don't crash if asked for an item by an invalid index., Danny Milosavljevic, 2017/07/03
- 171/197: installer: New page to edit user accounts., Danny Milosavljevic, 2017/07/03