Farrel Lifson schrieb:
> What is the justification for [1,2,[3,4]].join(',') being '1,2,3,4'
> instead of '1,2,34'? According to ruby-doc.org join "Returns a string
> created by converting each element of the array to a string, separated
> by sep.". Why should an element be recursively joined if it's also an
> array?
> 
> Farrel
> 

It is easy to come to the required result by

irb(main):001:0> [1,2,[3,4]].map{|e|e.to_s}.join(',')
=> "1,2,34"

...but I think this should be the "natural" way of handling it by "join". 
Implicit recursion (or "flatten" in this special case) can be confusing in some 
situation.

Wolfgang NŠŇasi-Donner