From: Arlen Cuss Date: 2008-04-18T10:35:20+09:00 Subject: Re: Parallel for loop ------=_Part_2625_4127896.1208482518614 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi, On Fri, Apr 18, 2008 at 11:15 AM, Fredrik wrote: > I was thinking about that too, but as far as I understand it Ruby only > allows optional arguments to be the last arguments - i.e. the "n" > parameter would have to appear after the code block. And that would > look strange : forkmap{ code }(4). > > It's different with blocks: irb(main):029:0> def this_that(val=nil) irb(main):030:1> puts "infinite?" if val.nil? irb(main):031:1> yield 42 irb(main):032:1> end => nil irb(main):033:0> this_that {|a| p a} infinite? 42 => nil irb(main):034:0> this_that(9) {|a| p a} 42 => nil irb(main):035:0> Arlen ------=_Part_2625_4127896.1208482518614--