Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
Syntactic Confectionery Delight
 
PerlMonks  

Re^4: List::MoreUtils before, after and ... between? (posting solutions for every possible interpretation)

by tye (Cardinal)
on Feb 22, 2012 at 04:31 UTC ( #955447=note: print w/ replies, xml ) Need Help??


in reply to Re^3: List::MoreUtils before, after and ... between? ("simple")
in thread List::MoreUtils before, after and ... between?

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.

Personally, I reject posting solutions for every possible interpretation of a poorly phrased question.

Human discussions are an iterative process.

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.

- tye        


Comment on Re^4: List::MoreUtils before, after and ... between? (posting solutions for every possible interpretation)
Re^5: List::MoreUtils before, after and ... between? (posting solutions for every possible interpretation)
by Boldra (Deacon) on Feb 22, 2012 at 08:42 UTC

    I'm very sorry that I didn't stick around for very long after posting this, and so warranted such detailed second-guessing of my intentions. Apologies!

    My intention was a mix: I had a specific problem where I was sure there would always be rubbish at both ends, but I was also curious about a function that would generally solve the "between" issue, which as I imagined it, would keep the middle, even if there was no rubbish at one of both ends.

    This is luckily also what my example does, even though I hadn't tested it in that case!



    - Boldra
Re^5: List::MoreUtils before, after and ... between? (posting solutions for every possible interpretation)
by LanX (Abbot) on Feb 22, 2012 at 14:05 UTC
    > I'm sorry that you appear to have taken offense at what I did.

    I'm not taking offense, but the whole interpretation discussion (not started by you) is somehow ridiculous, fruitless. And a running gag found in too many threads.

    IMHO there are three possible approaches:

  • 1. The monastery grants to everybody the power to read the questioner's mind. *

  • 2. Questions which are not mathematically clear are rejected and reaped.

  • 3. We post likely answers for the likely question.

    I'd rather stick with option 3.

    Cheers Rolf

    *) And the superpower to understand the real problem behind that mind. For instance I doubt that the OP was aware of possible edgecases like unsorted input or missing borders. BTW: I was.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://955447]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (13)
As of 2014-04-16 17:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (433 votes), past polls