|
From: | Joe Python |
Subject: | Re: [Chicken-users] Wish: Parallel Map |
Date: | Wed, 29 Dec 2010 17:57:54 -0500 |
Error: unbound variable: ##process#io-ports
Call history:
##sys#call-with-values
pthunk.scm:131: create-pipe
##sys#call-with-values
pthunk.scm:132: create-pipe
pthunk.scm:133: gc
pthunk.scm:134: process-fork
pthunk.scm:146: file-close
pthunk.scm:146: file-close
##sys#call-with-values
pthunk.scm:147: ##process#io-ports
Agree, I am a noob Schemer.
- Joe
Just got a few minutes off and was thinking: maybe you are a less
experienced Schemer asking for a parallel map executed by subprocesses.
Am Mittwoch, den 29.12.2010, 11:56 +0100 schrieb Jörg F. Wittenberger:
> Maybe this is better for you?A parallel map could then look like:
>
> Use like this:
>
> (process-call (lambda () 7)) => 7
(define (my-function a b) (+ a b))
(map thread-join!
(map (lambda (parameters)
(thread-start! (make-thread
(lambda ()
(process-call
(lambda ()
(apply my-function parameters))))
'parallel)))
'( (1 2) (3 4) (4 5))))
But Beware: my-function must not raise an exception and return ONLY
data, which is write/read idempotent (a restriction which probably
applies more or less to your Python example too).
[Prev in Thread] | Current Thread | [Next in Thread] |