From: Michael Guterl Date: 2008-04-16T13:26:02+09:00 Subject: Re: Parallel for loop On Tue, Apr 15, 2008 at 11:35 PM, Fredrik wrote: > There doesn't seem to be any EASY way of doing a parallel computation > in Ruby. > I would like to do something like this : > > array.map do |i| > fork do > i + 1 > end > end > Process.waitall > > wich would give back the array with one added to each element in an > array, and it would perform this "calculation" in parallel. However, > this doesn't work since fork runs a subprocess which is another Ruby > interpreter and I can't get anything back from that black hole, except > some exit status. > > Actually, it would be really nice if there was a 'forkmap' method that > could do this: > > array.forkmap do |i| > i + 1 > end > > But there isn't, right? > http://skynet.rubyforge.org/ HTH, Michael Guterl