guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#28274: [PATCH] gnu: Add fold-packages-in-modules.


From: Ludovic Courtès
Subject: bug#28274: [PATCH] gnu: Add fold-packages-in-modules.
Date: Fri, 01 Sep 2017 11:08:56 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)

Christopher Baines <address@hidden> skribis:

> On Thu, 31 Aug 2017 15:20:55 +0200
> address@hidden (Ludovic Courtès) wrote:
>
>> Instead of introducing a new procedure, what about simply:
>> 
>> 
>> diff --git a/gnu/packages.scm b/gnu/packages.scm
>> index 562906178..b4ac6661c 100644
>> --- a/gnu/packages.scm
>> +++ b/gnu/packages.scm
>> @@ -140,17 +140,19 @@ for system '~a'")
>>                directory))
>>          %load-path)))
>>  
>> -(define (fold-packages proc init)
>> -  "Call (PROC PACKAGE RESULT) for each available package, using INIT
>> as -the initial value of RESULT.  It is guaranteed to never traverse
>> the -same package twice."
>> +(define* (fold-packages proc init
>> +                        #:optional
>> +                        (modules (all-modules
>> (%package-module-path))))
>> +  "Call (PROC PACKAGE RESULT) for each available package defined in
>> one of +MODULES, using INIT as the initial value of RESULT.  It is
>> guaranteed to never +traverse the same package twice."
>>    (fold-module-public-variables (lambda (object result)
>>                                    (if (and (package? object)
>>                                             (not (hidden-package?
>> object))) (proc object result)
>>                                        result))
>>                                  init
>> -                                (all-modules
>> (%package-module-path))))
>> +                                modules))
>>  
>>  (define find-packages-by-name
>>    (let ((packages (delay
>> 
>> 
>> ?
>
> This looks great. Are you set to push it up, or shall I?

Pushed, thanks!

Ludo'.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]