[Pharo-project] flatten method is kind of broken

Tudor Girba tudor at tudorgirba.com
Sat Jun 16 02:07:32 EDT 2012


Indeed. It would be great to integrate CollectionExtensions into Pharo.

For example, we have:
#(#(1) #(2 3) #(#(4) 5)  ) deepFlatten
==>  #(1 2 3 4 5)

Cheers,
Doru

On 15 Jun 2012, at 21:04, Stéphane Ducasse wrote:

> fabrizio we should really include some of the moose extensions to pharo.
> Could you take the lead on that?
> 
> Did you try gather:?
> 
> Stef
> 
> On Jun 15, 2012, at 10:05 AM, Fabrizio Perin wrote:
> 
>> Hi,
>> I need to flatten a collection which does not contain other collections necessarily. The method flatten doesn't really work:
>> 
>> #(#(1 2) #(3 4)) flatten -> #(1 2 3 4) OK
>> 
>> #(#(1) #(2 3) #(#(4) 5)  ) flatten -> #(1 2 3 #(4) 5) I would have expected something like #(1 2 3 4 5)
>> 
>> #(1 2 3) flatten -> error
>> #(#(1) 2 3) flatten -> error
>> 
>> Is this the meant behavior for flatten? Any other method I could use instead?
>> 
>> Thanks,
>> Fabrizio
> 
> 

--
www.tudorgirba.com

"We are all great at making mistakes."











More information about the Pharo-dev mailing list