Message ID | b2f1c8cccc1c6150b7fc3d56af828c883186bdb7.1669918166.git.mirai@makinata.eu |
---|---|
State | New |
Headers | show |
Series | [bug#59747] services: configuration: rework alist? procedure | expand |
mirai@makinata.eu skribis: > 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’.
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)
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(-) base-commit: 748ec628826cea3faa3679074d87fae9bc810080