|Syntactic Confectionery Delight|
Re^4: List::MoreUtils before, after and ... between? (posting solutions for every possible interpretation)by tye (Sage)
|on Feb 22, 2012 at 04:31 UTC||Need Help??|
Maybe you mean mean "grep w/o reverse" ?
No, I meant "any simple 'grep' solution" (as I wrote). I don't consider what you proposed to be a "simple 'grep' solution". Perhaps it would help you see my point on that if you imagine yourself finding that code six months from now with no comments and trying to understand what was intended. Even now, having fresh knowledge of what your code is supposed to be doing, I find it fairly difficult to convince myself as to whether or not it is a correct implementation (based on "reading and understanding the code", not based on the test cases provided).
Please notice the word "between" in this thread's title.
Please notice the phrase "take rubbish away from the top and the bottom". 'No rubbish' means 'nothing to take away'. I don't find that to be ambiguous and I don't see it contradicting the simplified description of the problem in the title.
The original code was convoluted enough that I didn't spend much effort trying to understand it in detail, especially since the example data along with the explanation seemed quite clear. I don't know (and don't really care) what before() does with "no match", so I am unsure if you are pointing out that the original code acts like my code or that it acts different from my code.
If the original code removes everything in the face of there being no rubbish, then that might have been a bug due to the author not considering the possible edge case of "no rubbish". It might have been a conscious decision of the author based on an assessment that "there will always be rubbish on both ends". I find not having to rely on such an assumption to be an advantage.
It is possible that the original author considered the "no rubbish" case and wanted "no output" for that case but didn't bother to mention any of that in their query. I find that output enough at odds with "take rubbish away" (especially when given a stack trace) that I don't consider that supposed author behavior to be very likely. But, yes, it is possible.
I don't recall posting solutions for every possible interpretation of anything. Heck, I don't even find the description of the problem and desired solution "poorly phrased".
And I don't see how a reply to my reply is impossible or even difficult. The process can "iterate" from there quite simply.
I found what looked like a clear statement of a problem for which I quickly imagined a clear, simple solution. If you found the problem statement unclear, then I will not force you to reply with a solution. I'm sorry that you appear to have taken offense at what I did. Despite your protestations, it seems completely reasonable to me still.