[Top][All Lists]

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

Re: [Chicken-users] Wish: Parallel Map

From: Joe Python
Subject: Re: [Chicken-users] Wish: Parallel Map
Date: Wed, 29 Dec 2010 17:57:54 -0500


When I ran this I got 

Error: unbound variable: ##process#io-ports


        Call history:



        pthunk.scm:131: create-pipe


        pthunk.scm:132: create-pipe

        pthunk.scm:133: gc

        pthunk.scm:134: process-fork

        pthunk.scm:146: file-close

        pthunk.scm:146: file-close


        pthunk.scm:147: ##process#io-ports 


Agree, I am a noob Schemer.

- Joe

On Wed, Dec 29, 2010 at 8:37 AM, Jörg F. Wittenberger <address@hidden> wrote:
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 ()
                              (lambda ()
                                (apply my-function parameters))))
         '( (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]