On Sun, 20 Feb 2005 01:52:25 +0900, Yukihiro Matsumoto
<matz / ruby-lang.org> wrote:
>     on Sun, 20 Feb 2005 01:42:34 +0900, Simon Strandgaard <neoneye / gmail.com> writes:
> 
> |A proposal:
> |
> |[1, 2, 3, 4, 5, 6].join(0)    #-> [1, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6]
> 
> I think behavior that changes depends on indirect types (i.e. type of
> elements in the receiver this case) is not good idea.  A method gives
> a string should always gives string (or string-like object).
> This particular behavior (interleaving array elements with given
> value) might be useful, but should not be implemented by "Array#join".

good point. I just needed this behavior and the first thing that came to
mind was #join.  

Maybe better to name it  #interleave, like this

[1, 2, 3, 4, 5, 6].interleave(0)    #-> [1, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6]
[1, 2, 3, 4, 5, 6].interleave('hi')    #-> [1, 'hi', 2, 'hi', 3, 'hi',
4, 'hi', 5, 'hi', 6]


--
Simon Strandgaard