在 Oct 21, 2006 9:58 AM 時,Taral 寫到:

On 10/21/06, Audrey Tang <[EMAIL PROTECTED]> wrote:
I wonder if there is a more efficient way doing this...

I would use an IOArray:

let l = length xs
arr <- newArray_ (0, l)
count <- newQSemN 0
let proc n x = do
   rv <- runEvalIO env (reduce x)
   writeArray arr n rv
   signalQSemN count 1
sequence_ $ zipWith proc [0..] xs
waitQSemN count l
elems $ unsafeFreeze arr

Hmm, am I missing something here, but how does forkIO (and data parallelism) fit in into that scheme?

Thanks,
Audrey

_______________________________________________
Haskell mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to