guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/04: import/utils: Replace '.' by '-' in snake-case procedure.


From: guix-commits
Subject: 01/04: import/utils: Replace '.' by '-' in snake-case procedure.
Date: Sun, 15 Dec 2024 20:16:45 -0500 (EST)

apteryx pushed a commit to branch master
in repository guix.

commit 2c9867fde520bc05f85975e9a6fd4e46dc1dc4f9
Author: Maxim Cournoyer <maxim.cournoyer@gmail.com>
AuthorDate: Thu Dec 12 21:03:03 2024 +0900

    import/utils: Replace '.' by '-' in snake-case procedure.
    
    * guix/import/utils.scm (snake-case): Replace '.' by '-'.  Update doc.
    
    Change-Id: I46f2e066c82849627464d0690549288ebbc4e926
    Reviewed-by: Ludovic Courtès <ludo@gnu.org>
---
 guix/import/utils.scm | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/guix/import/utils.scm b/guix/import/utils.scm
index ccf18a7bf9..e45c8dfb20 100644
--- a/guix/import/utils.scm
+++ b/guix/import/utils.scm
@@ -317,9 +317,12 @@ object is bound to in the (guix licenses) module, such as 
'license:gpl3+, or
   (assoc-ref licenses license))
 
 (define (snake-case str)
-  "Return a downcased version of the string STR where underscores are replaced
-with dashes."
-  (string-join (string-split (string-downcase str) #\_) "-"))
+  "Return a downcased version of the string STR where underscores and periods
+are replaced with dashes."
+  (string-map (match-lambda
+                ((or #\_ #\.) #\-)
+                (chr chr))
+              (string-downcase str)))
 
 (define* (beautify-description description #:optional (length 80))
   "Improve the package DESCRIPTION by turning a beginning sentence fragment 
into



reply via email to

[Prev in Thread] Current Thread [Next in Thread]