Hello,

Chris Marusich <cmmarus...@gmail.com> skribis:

> From c1150a217a416ef4ceccf87c56e36e8e921f873a Mon Sep 17 00:00:00 2001
> From: Chris Marusich <cmmarus...@gmail.com>
> Date: Mon, 6 May 2019 01:51:30 -0700
> Subject: [PATCH] ui: Make package outputs searchable.
>
> * guix/ui.scm (relevance): Allow the "field" procedure of a metric to
> return a list, and handle that case appropriately.  Update docstring.
> (%package-metrics): Add a metric for package outputs.
> * guix/scripts/package.scm (find-packages-by-description): Update
> docstring.
>
> Co-authored-by: Tobias Geerinckx-Rice <m...@tobias.gr>

[...]

>               (match (field obj)
>                 (#f  relevance)
> -               (str (+ relevance
> -                       (* (score str) weight)))))))
> +               ((? string? str) (+ relevance
> +                                   (* (score str) weight)))
> +               ((? list? lst) (+ relevance
> +                                 (* weight
> +                                    (apply + (map score lst)))))))))

Nitpick: it’s a bit subjective, but I think this clause might be
slightly nicer like this:

  ((lst ...)
   (+ relevance (* weight (reduce + 0 (map score lst)))))

Anyway, LGTM!

Thanks,
Ludo’.



Reply via email to