guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

07/13: Fix par-map&


From: Christopher Baines
Subject: 07/13: Fix par-map&
Date: Fri, 19 Jan 2024 04:57:47 -0500 (EST)

cbaines pushed a commit to branch master
in repository data-service.

commit b8bd56a8f5441bb45f0f3731987fda27ccd9674f
Author: Christopher Baines <mail@cbaines.net>
AuthorDate: Thu Jan 18 14:40:48 2024 +0000

    Fix par-map&
    
    To actually work in parallel.
---
 guix-data-service/utils.scm | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/guix-data-service/utils.scm b/guix-data-service/utils.scm
index 09f47f8..5d7d4ba 100644
--- a/guix-data-service/utils.scm
+++ b/guix-data-service/utils.scm
@@ -479,16 +479,18 @@ available.  Return the resource once PROC has returned."
 
 (define (par-mapper' mapper cons)
   (lambda (proc . lists)
-    (let loop ((lists lists))
-      (match lists
-        (((heads tails ...) ...)
-         (let ((tail (loop tails))
-               (head (defer-to-parallel-fiber
-                       (lambda ()
-                         (apply proc heads)))))
-           (cons (fetch-result-of-defered-thunks head) tail)))
-        (_
-         '())))))
+    (apply
+     fetch-result-of-defered-thunks
+     (let loop ((lists lists))
+       (match lists
+         (((heads tails ...) ...)
+          (let ((tail (loop tails))
+                (head (defer-to-parallel-fiber
+                        (lambda ()
+                          (apply proc heads)))))
+            (cons head tail)))
+         (_
+          '()))))))
 
 (define par-map& (par-mapper' map cons))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]