[PATCH] services: configuration: rework alist? procedure

  • Open
  • quality assurance status badge
Details
2 participants
  • Ludovic Courtès
  • mirai
Owner
unassigned
Submitted by
mirai
Severity
normal
M
M
mirai wrote on 1 Dec 2022 19:09
(address . guix-patches@gnu.org)(name . Bruno Victal)(address . mirai@makinata.eu)
b2f1c8cccc1c6150b7fc3d56af828c883186bdb7.1669918166.git.mirai@makinata.eu
From: Bruno Victal <mirai@makinata.eu>

* gnu/services/configuration.scm: rework alist? procedure
---
gnu/services/configuration.scm | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

Toggle diff (21 lines)
diff --git a/gnu/services/configuration.scm b/gnu/services/configuration.scm
index dacfc52ba9..5bbb032c66 100644
--- a/gnu/services/configuration.scm
+++ b/gnu/services/configuration.scm
@@ -436,7 +436,11 @@ (define (list-of pred?)
(define list-of-strings?
(list-of string?))
-(define alist? list?)
+(define alist?
+ (match-lambda
+ (() #t)
+ ((and (= car head) (= cdr tail)) (and (pair? head) (alist? tail)))
+ (_ #f)))
(define serialize-file-like empty-serializer)

base-commit: 748ec628826cea3faa3679074d87fae9bc810080
--
2.38.1
L
L
Ludovic Courtès wrote on 8 Dec 2022 12:59
(address . mirai@makinata.eu)(address . 59747-done@debbugs.gnu.org)
87wn72ds3a.fsf@gnu.org
mirai@makinata.eu skribis:

Toggle quote (4 lines)
> From: Bruno Victal <mirai@makinata.eu>
>
> * gnu/services/configuration.scm: rework alist? procedure

I simplified it a bit and applied.

Note that there are two other ‘*-alist?’ procedures…

But really, it’s the kind of predicate that shouldn’t be used because
there’s no disjoint alist data type in the first place. It may be a
sign that we should use records instead in those places.

Thanks,
Ludo’.
Closed
M
M
mirai wrote on 8 Dec 2022 13:07
[PATCH v2] services: configuration: rework alist? procedure
(address . 59747@debbugs.gnu.org)(name . Bruno Victal)(address . mirai@makinata.eu)
f23b777741fcf9daeb7746e8dc93391fd66e771f.1670501226.git.mirai@makinata.eu
From: Bruno Victal <mirai@makinata.eu>

* gnu/services/configuration.scm: rework alist? procedure
---
gnu/services/configuration.scm | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

Toggle diff (18 lines)
diff --git a/gnu/services/configuration.scm b/gnu/services/configuration.scm
index 2b3bd4c1f4..e0a5bd6728 100644
--- a/gnu/services/configuration.scm
+++ b/gnu/services/configuration.scm
@@ -436,7 +436,8 @@ (define (list-of pred?)
(define list-of-strings?
(list-of string?))
-(define alist? list?)
+(define alist?
+ (list-of pair?))
(define serialize-file-like empty-serializer)

base-commit: fc774ece918d765f871d2fd079e622188e23f2da
--
2.38.1
B
B
Bruno Victal wrote on 25 Jan 17:37 +0100
[PATCH] services: configuration: simplify alist? procedure.
(address . 59747@debbugs.gnu.org)(name . Bruno Victal)(address . mirai@makinata.eu)
eacf0013c8cee01cb68caacc1093beb5548f71d1.1674664664.git.mirai@makinata.eu
* gnu/services/configuration.scm (alist?): simplify procedure.
---
gnu/services/configuration.scm | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)

Toggle diff (20 lines)
diff --git a/gnu/services/configuration.scm b/gnu/services/configuration.scm
index 6b0291dc00..d4d9c3b1a6 100644
--- a/gnu/services/configuration.scm
+++ b/gnu/services/configuration.scm
@@ -437,10 +437,7 @@ (define list-of-strings?
(list-of string?))
(define alist?
- (match-lambda
- (() #t)
- ((head . tail) (and (pair? head) (alist? tail)))
- (_ #f)))
+ (list-of pair?))
(define serialize-file-like empty-serializer)

base-commit: 0d713e0140f4c4a80de6cbfc58fae17cb69beb98
--
2.38.1
B
B
Bruno Victal wrote on 25 Jan 17:38 +0100
[PATCH v3] services: configuration: simplify alist? procedure.
(address . 59747@debbugs.gnu.org)(name . Bruno Victal)(address . mirai@makinata.eu)
eacf0013c8cee01cb68caacc1093beb5548f71d1.1674664705.git.mirai@makinata.eu
* gnu/services/configuration.scm (alist?): simplify procedure.
---

Last patch was sent without prefix.

gnu/services/configuration.scm | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)

Toggle diff (20 lines)
diff --git a/gnu/services/configuration.scm b/gnu/services/configuration.scm
index 6b0291dc00..d4d9c3b1a6 100644
--- a/gnu/services/configuration.scm
+++ b/gnu/services/configuration.scm
@@ -437,10 +437,7 @@ (define list-of-strings?
(list-of string?))
(define alist?
- (match-lambda
- (() #t)
- ((head . tail) (and (pair? head) (alist? tail)))
- (_ #f)))
+ (list-of pair?))
(define serialize-file-like empty-serializer)

base-commit: 0d713e0140f4c4a80de6cbfc58fae17cb69beb98
--
2.38.1
?