From: Ricardo Wurmus <rekado@elephly.net>
To: 46100@debbugs.gnu.org
Subject: [bug#46100] [PATCH 4/4] inferior: Memoize package input field access.
Date: Mon, 25 Jan 2021 14:37:38 +0100 [thread overview]
Message-ID: <20210125133738.15609-4-rekado@elephly.net> (raw)
In-Reply-To: <20210125133738.15609-1-rekado@elephly.net>
From: Ludovic Courtès <ludo@gnu.org>
* guix/inferior.scm (inferior-package-input-field): Return memoized procedure
accepting a package.
(inferior-package-inputs, inferior-package-native-inputs,
inferior-package-propagated-inputs,
inferior-package-transitive-propagated-inputs): Adapt.
---
guix/inferior.scm | 71 ++++++++++++++++++++++++-----------------------
1 file changed, 36 insertions(+), 35 deletions(-)
diff --git a/guix/inferior.scm b/guix/inferior.scm
index 0c85a9ea08..b5e8939a1d 100644
--- a/guix/inferior.scm
+++ b/guix/inferior.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2018, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2021 Ricardo Wurmus <rekado@elephly.net>
;;;
;;; This file is part of GNU Guix.
@@ -386,50 +386,51 @@ record."
loc)))
package-location))))
-(define (inferior-package-input-field package field)
+(define (inferior-package-input-field field)
"Return the input field FIELD (e.g., 'native-inputs') of PACKAGE, an
inferior package."
- (define field*
- `(compose (lambda (inputs)
- (map (match-lambda
- ;; XXX: Origins are not handled.
- ((label (? package? package) rest ...)
- (let ((id (object-address package)))
- (hashv-set! %package-table id package)
- `(,label (package ,id
- ,(package-name package)
- ,(package-version package))
- ,@rest)))
- (x
- x))
- inputs))
- ,field))
-
- (define inputs
- (inferior-package-field package field*))
-
- (define inferior
- (inferior-package-inferior package))
-
- (map (match-lambda
- ((label ('package id name version) . rest)
- ;; XXX: eq?-ness of inferior packages is not preserved here.
- `(,label ,(inferior-package inferior name version id)
- ,@rest))
- (x x))
- inputs))
+ (mlambdaq (package)
+ (define field*
+ `(compose (lambda (inputs)
+ (map (match-lambda
+ ;; XXX: Origins are not handled.
+ ((label (? package? package) rest ...)
+ (let ((id (object-address package)))
+ (hashv-set! %package-table id package)
+ `(,label (package ,id
+ ,(package-name package)
+ ,(package-version package))
+ ,@rest)))
+ (x
+ x))
+ inputs))
+ ,field))
+
+ (define inputs
+ (inferior-package-field package field*))
+
+ (define inferior
+ (inferior-package-inferior package))
+
+ (map (match-lambda
+ ((label ('package id name version) . rest)
+ ;; XXX: eq?-ness of inferior packages is not preserved here.
+ `(,label ,(inferior-package inferior name version id)
+ ,@rest))
+ (x x))
+ inputs)))
(define inferior-package-inputs
- (cut inferior-package-input-field <> 'package-inputs))
+ (inferior-package-input-field 'package-inputs))
(define inferior-package-native-inputs
- (cut inferior-package-input-field <> 'package-native-inputs))
+ (inferior-package-input-field 'package-native-inputs))
(define inferior-package-propagated-inputs
- (cut inferior-package-input-field <> 'package-propagated-inputs))
+ (inferior-package-input-field 'package-propagated-inputs))
(define inferior-package-transitive-propagated-inputs
- (cut inferior-package-input-field <> 'package-transitive-propagated-inputs))
+ (inferior-package-input-field 'package-transitive-propagated-inputs))
(define (%inferior-package-search-paths field)
"Return the list of search path specifications of PACKAGE, an inferior
--
2.29.2
prev parent reply other threads:[~2021-01-25 13:39 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-25 13:37 [bug#46101] [PATCH 1/4] guix: Fix typo Ricardo Wurmus
2021-01-25 13:37 ` [bug#46102] [PATCH 2/4] inferior: Memoize inferior-package->manifest-entry Ricardo Wurmus
2021-01-26 10:41 ` [bug#46100] [PATCH 0/4] Memoize inferior package access Ludovic Courtès
2021-01-26 11:30 ` Ludovic Courtès
2021-01-26 12:38 ` Ricardo Wurmus
2021-01-27 23:18 ` Ludovic Courtès
2021-01-28 11:53 ` Ricardo Wurmus
2021-01-28 13:16 ` bug#46100: " Ludovic Courtès
2021-01-25 13:37 ` [bug#46101] [PATCH 3/4] inferior: Memoize inferior package search path access Ricardo Wurmus
2021-01-25 13:37 ` Ricardo Wurmus [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210125133738.15609-4-rekado@elephly.net \
--to=rekado@elephly.net \
--cc=46100@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).