Re: better flatten()?
- Posted by DerekParnell (admin) Jul 27, 2015
- 1515 views
ghaberek said...
petelomax said...
I'm not absolutely against the idea of two functions, but I'm not convinced we really need that split yet either.
It seemed reasonable to me that flatten_all() always returned a sequence of atoms, but flatten_seq() handled strings gracefully.
-Greg
My code implements flatten_all when the delimiter is {}, and flatten_seq when given a delimiter. Euphoria makes no fundamental distinction between strings and sequences. For example, how should flatten() handle {"Range", {-3.45, 102.50}} given the delimiter " is "?