Download Firefox: WindowsMac OS X
logo       
Google Custom Search
    AddThis Social Bookmark Button

Re: Update to Array#join: msg#00006

Subject: Re: Update to Array#join

On Feb 15, 2007, at 5:35 AM, Ryan Davis wrote:
try something like:

Every sub-array is converted to a string by applying join recursively, essentially flattening the array.

I thought of this also but it suggests to me that #join itself is
called on the sub-array, which is not true.  The recursive algorithm
is implemented entirely within Array#join.

I considered this detail important because if someone had defined
#join for the subarray (as a singleton method) then they might think
they could 'override' the behavior of #join for that element of the
array.

Anyway, that is why I avoided any reference to #flatten and to #join.

Gary Wright







<Prev in Thread] Current Thread [Next in Thread>