unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Ricardo Wurmus <rekado@elephly.net>
To: 46100@debbugs.gnu.org, 46101@debbugs.gnu.org
Subject: [bug#46101] [PATCH 3/4] inferior: Memoize inferior package search path access.
Date: Mon, 25 Jan 2021 14:37:37 +0100	[thread overview]
Message-ID: <20210125133738.15609-3-rekado@elephly.net> (raw)
In-Reply-To: <20210125133738.15609-1-rekado@elephly.net>

* guix/inferior.scm (%inferior-package-search-paths): Return memoized
procedure accepting a package.
(inferior-package-native-search-paths, inferior-package-search-paths,
inferior-package-transitive-native-search-paths): Adapt.
---
 guix/inferior.scm | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/guix/inferior.scm b/guix/inferior.scm
index 7bfce5d810..0c85a9ea08 100644
--- a/guix/inferior.scm
+++ b/guix/inferior.scm
@@ -45,6 +45,7 @@
   #:use-module (guix store)
   #:use-module (guix derivations)
   #:use-module (guix base32)
+  #:use-module ((guix memoization) #:select (mlambdaq))
   #:use-module (gcrypt hash)
   #:autoload   (guix cache) (maybe-remove-expired-cache-entries
                              file-expiration-time)
@@ -430,27 +431,28 @@ inferior package."
 (define inferior-package-transitive-propagated-inputs
   (cut inferior-package-input-field <> 'package-transitive-propagated-inputs))
 
-(define (%inferior-package-search-paths package field)
+(define (%inferior-package-search-paths field)
   "Return the list of search path specifications of PACKAGE, an inferior
 package."
-  (define paths
-    (inferior-package-field package
-                            `(compose (lambda (paths)
-                                        (map (@ (guix search-paths)
-                                                search-path-specification->sexp)
-                                             paths))
-                                      ,field)))
+  (mlambdaq (package)
+    (define paths
+      (inferior-package-field package
+                              `(compose (lambda (paths)
+                                          (map (@ (guix search-paths)
+                                                  search-path-specification->sexp)
+                                               paths))
+                                        ,field)))
 
-  (map sexp->search-path-specification paths))
+    (map sexp->search-path-specification paths)))
 
 (define inferior-package-native-search-paths
-  (cut %inferior-package-search-paths <> 'package-native-search-paths))
+  (%inferior-package-search-paths 'package-native-search-paths))
 
 (define inferior-package-search-paths
-  (cut %inferior-package-search-paths <> 'package-search-paths))
+  (%inferior-package-search-paths 'package-search-paths))
 
 (define inferior-package-transitive-native-search-paths
-  (cut %inferior-package-search-paths <> 'package-transitive-native-search-paths))
+  (%inferior-package-search-paths 'package-transitive-native-search-paths))
 
 (define (inferior-package-provenance package)
   "Return a \"provenance sexp\" for PACKAGE, an inferior package.  The result
-- 
2.29.2






  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 ` Ricardo Wurmus [this message]
2021-01-25 13:37 ` [bug#46100] [PATCH 4/4] inferior: Memoize package input field access Ricardo Wurmus

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-3-rekado@elephly.net \
    --to=rekado@elephly.net \
    --cc=46100@debbugs.gnu.org \
    --cc=46101@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).