chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] Wish: Parallel Map


From: F. Wittenberger
Subject: Re: [Chicken-users] Wish: Parallel Map
Date: Wed, 29 Dec 2010 14:37:37 +0100

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?
> 
> Use like this:
> 
> (process-call (lambda () 7)) => 7

A parallel map could then look like:

(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).





reply via email to

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