From: timsuth@... (Tim Sutherland) Date: 2002-03-31T10:07:47+09:00 Subject: Re: Array#join accept a codeblock? In article , Tom Robinson wrote: >Is there some way to do something like Array#join that takes a >codeblock to tell it what to join up the array with? Something >like... > >ary = [1,2,3,4,5] >str = ary.myjoin { |idx| > if idx == 1 > ' ** ' > else > ' -- ' > end >} [...] This is an interesting idea. However, I'd suggest the comparison use the actual element rather than the index. Additionally, since join takes place between two elements, perhaps the block should take two elements as arguments. [...] -- "Open the pod bay doors, HAL." -- Dave Bowman, 2001