[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
11/16: packages: Turn 'cache!' into a single-value-return cache.
From: |
Ludovic Courtès |
Subject: |
11/16: packages: Turn 'cache!' into a single-value-return cache. |
Date: |
Wed, 28 Jun 2017 17:48:55 -0400 (EDT) |
civodul pushed a commit to branch wip-build-systems-gexp
in repository guix.
commit 6a8726927c8d471ea3def3effc834bf6f9b77947
Author: Ludovic Courtès <address@hidden>
Date: Sun Jun 25 16:31:33 2017 +0200
packages: Turn 'cache!' into a single-value-return cache.
* guix/packages.scm (cache!): Assume THUNK returns a single value.
---
guix/packages.scm | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/guix/packages.scm b/guix/packages.scm
index 3621cfe..36c5884 100644
--- a/guix/packages.scm
+++ b/guix/packages.scm
@@ -819,14 +819,14 @@ OVERRIDES."
SYSTEM."
;; FIXME: This memoization should be associated with the open store, because
;; otherwise it breaks when switching to a different store.
- (let ((vals (call-with-values thunk list)))
+ (let ((result (thunk)))
;; Use `hashq-set!' instead of `hash-set!' because `hash' returns the
;; same value for all structs (as of Guile 2.0.6), and because pointer
;; equality is sufficient in practice.
(hashq-set! cache package
- `((,system ,@vals)
+ `((,system ,result)
,@(or (hashq-ref cache package) '())))
- (apply values vals)))
+ result))
(define-syntax cached
(syntax-rules (=>)
- 08/16: packages: Simplify patch instantiation., (continued)
- 08/16: packages: Simplify patch instantiation., Ludovic Courtès, 2017/06/28
- 03/16: gexp: Micro-optimize sexp serialization., Ludovic Courtès, 2017/06/28
- 04/16: tests: Add 'test-assertm' to (guix tests)., Ludovic Courtès, 2017/06/28
- 13/16: utils: Memoize 'absolute-dirname'., Ludovic Courtès, 2017/06/28
- 12/16: gexp: 'local-file' calls 'canonicalize-path' only in rare cases., Ludovic Courtès, 2017/06/28
- 14/16: download: 'built-in-builders*' relies on the functional cache., Ludovic Courtès, 2017/06/28
- 01/16: gnu: bootstrap: Move 'use-modules' forms to the beginning of build expressions., Ludovic Courtès, 2017/06/28
- 15/16: store: Add 'GUIX_PROFILING' support for the object cache., Ludovic Courtès, 2017/06/28
- 09/16: Use 'mapm' instead of 'sequence' + 'map'., Ludovic Courtès, 2017/06/28
- 05/16: packages: Turn 'bag->derivation' into a monadic procedure., Ludovic Courtès, 2017/06/28
- 11/16: packages: Turn 'cache!' into a single-value-return cache.,
Ludovic Courtès <=
- 06/16: store: Add a functional object cache and use it in 'lower-object'., Ludovic Courtès, 2017/06/28
- 10/16: gexp: 'imported-files' takes file-like objects., Ludovic Courtès, 2017/06/28
- 07/16: DRAFT gexp: Handle list conversion to <gexp-input> in the expanded code., Ludovic Courtès, 2017/06/28
- 16/16: packages: Core procedures are written in monadic style., Ludovic Courtès, 2017/06/28
- 02/16: build-system: Rewrite using gexps., Ludovic Courtès, 2017/06/28