GNU bug report logs -
#36763
`guix search` does unexpected logical and
Previous Next
Reported by: zimoun <zimon.toutoune <at> gmail.com>
Date: Mon, 22 Jul 2019 17:13:02 UTC
Severity: normal
Done: Ludovic Courtès <ludo <at> gnu.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 36763 in the body.
You can then email your comments to 36763 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-guix <at> gnu.org
:
bug#36763
; Package
guix
.
(Mon, 22 Jul 2019 17:13:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
zimoun <zimon.toutoune <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-guix <at> gnu.org
.
(Mon, 22 Jul 2019 17:13:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Dear,
As discussed here [1], the `relevance` in `guix/ui.scm` does not match
"inter-field".
Attached a fix.
Now, the example from the manual
$ guix search crypto library | \
recsel -e '! (name ~ "^(ghc|perl|python|ruby)")' -p name,synopsis
outputs the expected crypto libraries as `libb2`.
Please comment. :-)
Then, please indicate me how the commit has to be filled.
The commit 8874faaaac665100a095ef25e39c9a389f5a397f introducing the
logical AND says:
ui: 'relevance' considers regexps connected with a logical and.
* guix/ui.scm (relevance)[score]: Change to return 0 when one of REGEXPS
doesn't match.
* tests/ui.scm ("package-relevance"): New test.
Should another test be added?
[1] https://lists.gnu.org/archive/html/guix-devel/2019-07/msg00263.html
Thank you in advance,
simon
[search.patch (text/x-patch, attachment)]
Merged 36757 36763 36770.
Request was from
Efraim Flashner <efraim <at> flashner.co.il>
to
control <at> debbugs.gnu.org
.
(Tue, 23 Jul 2019 07:09:02 GMT)
Full text and
rfc822 format available.
Disconnected #36763 from all other report(s).
Request was from
Efraim Flashner <efraim <at> flashner.co.il>
to
control <at> debbugs.gnu.org
.
(Tue, 23 Jul 2019 13:02:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-guix <at> gnu.org
:
bug#36763
; Package
guix
.
(Thu, 25 Jul 2019 17:36:01 GMT)
Full text and
rfc822 format available.
Message #12 received at 36763 <at> debbugs.gnu.org (full text, mbox):
Hi Simon,
zimoun <zimon.toutoune <at> gmail.com> skribis:
> As discussed here [1], the `relevance` in `guix/ui.scm` does not match
> "inter-field".
>
> Attached a fix.
> Now, the example from the manual
> $ guix search crypto library | \
> recsel -e '! (name ~ "^(ghc|perl|python|ruby)")' -p name,synopsis
> outputs the expected crypto libraries as `libb2`.
Nice!
> Then, please indicate me how the commit has to be filled.
> The commit 8874faaaac665100a095ef25e39c9a389f5a397f introducing the
> logical AND says:
>
> ui: 'relevance' considers regexps connected with a logical and.
>
> * guix/ui.scm (relevance)[score]: Change to return 0 when one of REGEXPS
> doesn't match.
> * tests/ui.scm ("package-relevance"): New test.
Yes, you can provide a commit log along these lines.
> Should another test be added?
Yes please, that would be perfect!
> + (define (update relevance weight scores)
> + (map + relevance
> + (map (lambda (score)
> + (* weight score))
> + scores)))
> +
> + (let ((scores (fold (lambda (metric relevance)
> + (match metric
> + ((field . weight)
> + (match (field obj)
> + (#f relevance)
> + ((? string? str)
> + (update relevance weight (score str)))
> + ((lst ...)
> + (update relevance weight
> + (fold (lambda (elem prev)
> + (if (zero? (length elem))
> + prev
> + (map + elem prev)))
> + (make-list (length regexps) 0)
> + (map score lst)))
> + )))))
> + (make-list (length regexps) 0)
> + metrics)))
I don’t have a clear mind on that, but I feel like this could be
simplified somehow. For instance,
(fold p (make-list …) metrics)
looks a lot like:
(map (lambda (x) (fold p x metrics)) regexps)
Well, something like that. :-)
Thanks for working on it!
Ludo’.
Information forwarded
to
bug-guix <at> gnu.org
:
bug#36763
; Package
guix
.
(Fri, 13 Sep 2019 18:25:02 GMT)
Full text and
rfc822 format available.
Message #15 received at 36763 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hi Ludo,
Thank you to look at it.
On Thu, 25 Jul 2019 at 19:35, Ludovic Courtès <ludo <at> gnu.org> wrote:
> (fold p (make-list …) metrics)
>
> looks a lot like:
>
> (map (lambda (x) (fold p x metrics)) regexps)
>
> Well, something like that. :-)
Second try attached with your advice. :-)
I am not sure where to place the newlines on long line.
Then I will try to add tests and send it.
Thank you.
All the best,
simon
[search.patch2 (application/octet-stream, attachment)]
Information forwarded
to
bug-guix <at> gnu.org
:
bug#36763
; Package
guix
.
(Mon, 16 Sep 2019 08:18:02 GMT)
Full text and
rfc822 format available.
Message #18 received at 36763 <at> debbugs.gnu.org (full text, mbox):
Hello!
zimoun <zimon.toutoune <at> gmail.com> skribis:
> On Thu, 25 Jul 2019 at 19:35, Ludovic Courtès <ludo <at> gnu.org> wrote:
>
>> (fold p (make-list …) metrics)
>>
>> looks a lot like:
>>
>> (map (lambda (x) (fold p x metrics)) regexps)
>>
>> Well, something like that. :-)
>
> Second try attached with your advice. :-)
Neat!
> + (let ((scores (map
> + (lambda (regexp)
> + (fold
> + (lambda (metric relevance)
> + (match metric
> + ((field . weight)
> + (match (field obj)
> + (#f relevance)
> + ((? string? str)
> + (+ relevance (* (score str regexp) weight)))
> + ((lst ...)
> + (+ relevance (* weight
> + (apply + (map
> + (lambda (str)
> + (score str regexp))
> + lst)))))))))
> + 0 metrics))
> + regexps)))
For readability, I’d suggest giving a name to one of the two lambdas
above, so you can write, say:
(map regexp-scores regexps)
where:
(define (regexp-scores regexp)
(fold (lambda (metric relevance)
…)
…))
Also, could you add a couple of tests (such as the “libb2” example for
“crypto” + “library” you mentioned earlier)? You can add them to the
existing “package-relevance” test in tests/ui.scm.
Bonus points if you send the patch with ‘git format-patch’ and with a
commit log:
https://guix.gnu.org/manual/en/html_node/Submitting-Patches.html
Thank you!
Ludo’.
Information forwarded
to
bug-guix <at> gnu.org
:
bug#36763
; Package
guix
.
(Thu, 19 Sep 2019 17:33:02 GMT)
Full text and
rfc822 format available.
Message #21 received at 36763 <at> debbugs.gnu.org (full text, mbox):
Hi Ludo,
On Mon, 16 Sep 2019 at 10:17, Ludovic Courtès <ludo <at> gnu.org> wrote:
> Bonus points if you send the patch with ‘git format-patch’ and with a
> commit log:
I did my best here:
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=37448
Hope I am doing right.
Thanks,
simon
Reply sent
to
Ludovic Courtès <ludo <at> gnu.org>
:
You have taken responsibility.
(Thu, 19 Sep 2019 19:57:01 GMT)
Full text and
rfc822 format available.
Notification sent
to
zimoun <zimon.toutoune <at> gmail.com>
:
bug acknowledged by developer.
(Thu, 19 Sep 2019 19:57:02 GMT)
Full text and
rfc822 format available.
Message #26 received at 36763-done <at> debbugs.gnu.org (full text, mbox):
Hello,
zimoun <zimon.toutoune <at> gmail.com> skribis:
> On Mon, 16 Sep 2019 at 10:17, Ludovic Courtès <ludo <at> gnu.org> wrote:
>
>> Bonus points if you send the patch with ‘git format-patch’ and with a
>> commit log:
>
> I did my best here:
> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=37448
>
> Hope I am doing right.
Yup!
We can close it now, thank you.
Ludo’.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 18 Oct 2019 11:24:09 GMT)
Full text and
rfc822 format available.
This bug report was last modified 5 years and 193 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.