[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
11/11: packages: Turn 'cache!' into a single-value-return cache.
From: |
Ludovic Courtès |
Subject: |
11/11: packages: Turn 'cache!' into a single-value-return cache. |
Date: |
Sun, 25 Jun 2017 16:12:16 -0400 (EDT) |
civodul pushed a commit to branch wip-build-systems-gexp
in repository guix.
commit 0b64b8c6b3338ecaa03bb46f236f105dc922f411
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 (=>)
- branch wip-build-systems-gexp created (now 0b64b8c), Ludovic Courtès, 2017/06/25
- 03/11: gexp: Micro-optimize sexp serialization., Ludovic Courtès, 2017/06/25
- 08/11: packages: Simplify patch instantiation., Ludovic Courtès, 2017/06/25
- 05/11: packages: Turn 'bag->derivation' into a monadic procedure., Ludovic Courtès, 2017/06/25
- 01/11: gnu: bootstrap: Move 'use-modules' forms to the beginning of build expressions., Ludovic Courtès, 2017/06/25
- 04/11: tests: Add 'test-assertm' to (guix tests)., Ludovic Courtès, 2017/06/25
- 09/11: Use 'mapm' instead of 'sequence' + 'map'., Ludovic Courtès, 2017/06/25
- 06/11: store: Add a functional object cache and use it in 'lower-object'., Ludovic Courtès, 2017/06/25
- 11/11: packages: Turn 'cache!' into a single-value-return cache.,
Ludovic Courtès <=
- 10/11: gexp: 'imported-files' takes file-like objects., Ludovic Courtès, 2017/06/25
- 07/11: DRAFT gexp: Handle list conversion to <gexp-input> in the expanded code., Ludovic Courtès, 2017/06/25
- 02/11: build-system: Rewrite using gexps., Ludovic Courtès, 2017/06/25