GNU bug report logs - #63955
[PATCH 0/5] Add pam-gnupg support for Greetd

Previous Next

Package: guix-patches;

Reported by: wurt <at> wurtshell.com

Date: Thu, 8 Jun 2023 04:31:03 UTC

Severity: normal

Tags: patch

Done: Carlos Durán Domínguez <wurt <at> wurtshell.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: wurt <at> wurtshell.com
To: 63955 <at> debbugs.gnu.org
Cc: Carlos Durán Domínguez <wurt <at> wurtshell.com>
Subject: [bug#63955] [PATCH 1/5] utils: Add insert-before.
Date: Thu,  8 Jun 2023 17:14:35 +0200
From: Carlos Durán Domínguez <wurt <at> wurtshell.com>

---
 guix/utils.scm | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/guix/utils.scm b/guix/utils.scm
index b9657df292..5773b55116 100644
--- a/guix/utils.scm
+++ b/guix/utils.scm
@@ -17,6 +17,7 @@
 ;;; Copyright © 2022 Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org>
 ;;; Copyright © 2022 Antero Mejr <antero <at> mailbox.org>
 ;;; Copyright © 2023 Philip McGrath <philip <at> philipmcgrath.com>
+;;; Copyright © 2023 Carlos Durán Domínguez <wurt <at> wurtshell.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -149,7 +150,9 @@ (define-module (guix utils)
             string-distance
             string-closest
 
-            pretty-print-table))
+            pretty-print-table
+
+            insert-before))
 
 
 ;;;
@@ -1128,6 +1131,19 @@ (define* (string-closest trial tests #:key (threshold 3))
            #f +inf.0
            tests)))
 
+
+;;;
+;;; List modification.
+;;;
+
+(define (insert-before pred lst1 lst2)
+  "Return a list appending LST2 just before the first element on LST1 that
+ satisfy the predicate PRED."
+  (cond
+   ((null? lst1) lst2)
+   ((pred (car lst1)) (append lst2 lst1))
+   (else (cons (car lst1) (insert-before pred (cdr lst1) lst2)))))
+
 
 ;;;
 ;;; Prettified output.
-- 
2.40.1





This bug report was last modified 1 year and 266 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.