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,16 +479,18 @@ available. Return the resource once PROC has returned."
(define (par-mapper' mapper cons) (define (par-mapper' mapper cons)
(lambda (proc . lists) (lambda (proc . lists)
(let loop ((lists lists)) (apply
(match lists fetch-result-of-defered-thunks
(((heads tails ...) ...) (let loop ((lists lists))
(let ((tail (loop tails)) (match lists
(head (defer-to-parallel-fiber (((heads tails ...) ...)
(lambda () (let ((tail (loop tails))
(apply proc heads))))) (head (defer-to-parallel-fiber
(cons (fetch-result-of-defered-thunks head) tail))) (lambda ()
(_ (apply proc heads)))))
'()))))) (cons head tail)))
(_
'()))))))
(define par-map& (par-mapper' map cons)) (define par-map& (par-mapper' map cons))