Subject: Re: bug#57460: [PATCH 00/19] Refresh to specific version

From: Ludovic Courtès <[email-masked]>
Date: Sat, 24 Sep 2022 11:29:24 +0200

Hartmut Goebel <[email-masked]> 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.

> +  (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))

?

Otherwise LGTM.