Fix par-map&

To actually work in parallel.
This commit is contained in:
Christopher Baines 2024-01-18 14:40:48 +00:00
parent 46b4c87e92
commit b8bd56a8f5

View file

@ -479,6 +479,8 @@ available. Return the resource once PROC has returned."
(define (par-mapper' mapper cons) (define (par-mapper' mapper cons)
(lambda (proc . lists) (lambda (proc . lists)
(apply
fetch-result-of-defered-thunks
(let loop ((lists lists)) (let loop ((lists lists))
(match lists (match lists
(((heads tails ...) ...) (((heads tails ...) ...)
@ -486,9 +488,9 @@ available. Return the resource once PROC has returned."
(head (defer-to-parallel-fiber (head (defer-to-parallel-fiber
(lambda () (lambda ()
(apply proc heads))))) (apply proc heads)))))
(cons (fetch-result-of-defered-thunks head) tail))) (cons head tail)))
(_ (_
'()))))) '()))))))
(define par-map& (par-mapper' map cons)) (define par-map& (par-mapper' map cons))