From 5c5ae46c00fd553c6fd23aeba1961e201f6555c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Fri, 1 Sep 2017 10:26:27 +0200 Subject: [PATCH] packages: 'fold-packages' takes an optional 'modules' parameter. Suggested by Christopher Baines . * gnu/packages.scm (fold-packages): Add optional 'modules' parameter and honor it. --- gnu/packages.scm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/gnu/packages.scm b/gnu/packages.scm index 5629061788..b4ac6661ca 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