[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#69052] [PATCH v2] gnu: guix: Correct home-channels-service-type ext
From: |
Ludovic Courtès |
Subject: |
[bug#69052] [PATCH v2] gnu: guix: Correct home-channels-service-type extension logic. |
Date: |
Sat, 02 Mar 2024 16:19:51 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Hi,
Nicolas Graves <ngraves@ngraves.fr> skribis:
> * gnu/home/services/guix.scm
> (extend-channel-list): Add function.
> (home-channels-service-type)[extend]: Use extend-channel-list.
>
> Change-Id: I587207b86216f075a54b6ed0b8fa998896bbed74
[...]
> +(define (channel-name-symbol channel)
> + (match (channel-name channel)
> + ((? symbol? name) name)
> + ((? string? name) (string->symbol name))))
‘channel-name’ always returns a symbol so this procedure can be removed.
> +(define (extend-channel-list default new)
> + "Prepend the channels in NEW by the channels in DEFAULT if their
> +channel-name is not in NEW."
> + (fold-right
> + (lambda (channel acc)
> + (if (member (channel-name channel) (map channel-name-symbol acc))
> + acc
> + (cons channel acc)))
> + new default))
[...]
> + (extend extend-channel-list)
I believe it’s equivalent to:
(define (extend-channel-list initial new)
(delete-duplicates
(append initial new)
(lambda (channel1 channel2)
(eq? (channel-name channel1) (channel-name channel2)))))
… which is somewhat clearer IMO.
Could you send an updated patch?
Ludo’.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [bug#69052] [PATCH v2] gnu: guix: Correct home-channels-service-type extension logic.,
Ludovic Courtès <=