[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#57460] [PATCH 00/19] Refresh to specific version
From: |
Maxime Devos |
Subject: |
[bug#57460] [PATCH 00/19] Refresh to specific version |
Date: |
Sat, 24 Sep 2022 12:25:28 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 |
On 24-09-2022 11:29, Ludovic Courtès wrote:
Hartmut Goebel <h.goebel@crazy-compilers.com> skribis:
* guix/import/gnome.scm(latest-gnome-release): Rename
to (import-gnome-release), add keyword-argument 'version'. If version is
given, try to find the respective version
[find-latest-release]: New function, based on former code.
[find-version-release]: New function.
[...]
+ (define (find-latest-release releases)
+ (fold (match-lambda*
+ (((key . value) result)
+ (cond ((even-minor-version? key)
+ (match result
+ (#f
+ (cons key value))
+ ((newest . _)
+ (if (version>? key newest)
+ (cons key value)
+ result))))
Please reindent ‘match’ as it was.
"guix style" is IMO not usable here
(<https://issues.guix.gnu.org/58040>: "guix style" puts closing
parentheses on the wrong line").
+ (define (find-version-release releases version)
+ (fold (match-lambda*
+ (((key . value) result)
+ (if (string=? key version)
+ (cons key value)
+ result)))
+ #f
+ releases))
I guess we could start at the first match instead of traversing all the
list, no? How about:
(define (find-version-release releases version)
(find (match-lambda
((key . value)
(string=? key version)))
releases))
?
(1) according to "guix style", this should be
(define (find-version-release releases version)
(find (match-lambda
((key . value) (string=? key version))) releases))
(2) Isn't this an inline definition of 'assoc' (except for replacing
equal? by string=?)?
(use-modules (srfi srfi-1)) ; the third argument is only documented in
SRFI-1 Asosciation Lists
(define (find-version-release releases version)
(assoc version releases string=?)
Some code duplication can be avoided here.
Greetings,
Maxime.
OpenPGP_0x49E3EE22191725EE.asc
Description: OpenPGP public key
OpenPGP_signature
Description: OpenPGP digital signature
- [bug#57460] [PATCH 00/19] Refresh to specific version, Ludovic Courtès, 2022/09/24
- [bug#57460] [PATCH 00/19] Refresh to specific version, Ludovic Courtès, 2022/09/24
- [bug#57460] [PATCH 00/19] Refresh to specific version, Ludovic Courtès, 2022/09/24
- [bug#57460] [PATCH 00/19] Refresh to specific version, Ludovic Courtès, 2022/09/24
- [bug#57460] [PATCH 00/19] Refresh to specific version, Ludovic Courtès, 2022/09/24
- [bug#57460] [PATCH 00/19] Refresh to specific version,
Maxime Devos <=
- [bug#57460] [PATCH 00/19] Refresh to specific version, Ludovic Courtès, 2022/09/24
- [bug#57460] [PATCH 00/19] Refresh to specific version, Ludovic Courtès, 2022/09/24
- [bug#57460] [PATCH 00/19] Refresh to specific version, Ludovic Courtès, 2022/09/24