Begin forwarded message:

From: Simon Denier <Simon.Denier@inria.fr>
Date: 27 août 2010 14:06:42 HAEC
To: A friendly place where any question about pharo is welcome <pharo-users@lists.gforge.inria.fr>
Cc: Simon Denier <Simon.Denier@inria.fr>
Subject: Robust flatten for collection?

Hi there

A question to test your sagacity :)

I'm looking for a method which would flatten a collection, regardless of whether the collection is already flat or not.


that is:
#((1 2 3) (4 5 6)) flatten  --> #(1 2 3 4 5 6)

#(1 2 3 4 5 6) flatten  --> #(1 2 3 4 5 6)

#((1 2 3) 4 5 6) flatten  --> #(1 2 3 4 5 6)


Any idea about the best implementation for this?


--
Simon




--
 Simon