Re: better flatten()?
- Posted by jimcbrown (admin) Jul 28, 2015
- 1490 views
Considering that you apparently seem to be the original author of that phrase, and the delim functionality of flatten() itself in the first place, I think you would know that best.
Yeah ... you'd think so, right? Oh well ... I can't remember doing any of those changes to Jeremy's original code.
Understandable, considering it's been over half a decade. (Anyways, I think most of the sillyness in that function is from CChris.)
(I would suggest modifying the docs to make that more explict in the future however: 'An optional delimiter to place after each flattened sub-sequence (except if the sub-sequence is the last element).')
I might if I could work out Hg. (That software is sooooo unintuitive, IMO)
Note to Tom!
I'm wondering if we shoudl revisit Heechee or another Hg-SVN gateway. Or even just move back to svn altogether.
I am curious as to the rationale, though, of distinguishing between the two cases. That is, why should flatten() only insert a delimiter up to the last subsequence (or last element that is a sequence), and continue to append atomic elements after that without a delimiter? Seems to open the door to other kinds of weird cases. (E.g. if flatten() is passed a sequence that is already flat, and also given a delimiter, should merely return the original string or should it insert a delimiter between each of the atomic elements?)
I don't know. I have not really had a need to use this function.
Why have the delim stuff in the first place? Euphoria generally doesn't follow the KISS principle, but I wonder if that's making the function overcomplicated. Does anybody use it?