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

commit de4bafdf5e59d71f08d8a599846ad9e128adeda0
Author: John Darrington <[email protected]>
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))

Reply via email to