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

commit 899995c62e9401c987545452391a26ffe583e24b
Author: John Darrington <[email protected]>
Date:   Fri Jan 27 08:41:38 2017 +0100

    gurses: Avoid one usage of car and cdr.
    
    * gurses/stexi.scm (offset-to-end-of-word): Replace car and cdr with match.
---
 gurses/stexi.scm | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/gurses/stexi.scm b/gurses/stexi.scm
index 67ffd4e..b49ff4d 100644
--- a/gurses/stexi.scm
+++ b/gurses/stexi.scm
@@ -105,13 +105,13 @@ described by the stexi STXI"
   "Return the number of xchars until the end of the current word."
 
   (define (offset-to-end-of-word' cs dist)
-    (cond
-     ((zero? (length cs))
-      dist)
-     ((char-set-contains? char-set:blank (car (xchar-chars (car cs))))
-      dist)
-     (else
-      (offset-to-end-of-word' (cdr cs) (1+ dist)))))
+    (match
+     cs
+     ('() dist)
+     (((? xchar? first) . rest)
+      (if (char-set-contains? char-set:blank (car (xchar-chars first)))
+          dist
+          (offset-to-end-of-word' rest (1+ dist))))))
 
   (offset-to-end-of-word' ccs 0))
 

Reply via email to