Fix par-map&
To actually work in parallel.
This commit is contained in:
parent
46b4c87e92
commit
b8bd56a8f5
1 changed files with 12 additions and 10 deletions
|
|
@ -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))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue