in reply to Re^2: Opening random files then reading random lines from file.
in thread Opening random files then reading random lines from file.

I think you made my point that it is "complicated"
(not easily explained and understood)..
  • Comment on Re^3: Opening random files then reading random lines from file.

Replies are listed 'Best First'.
Re^4: Opening random files then reading random lines from file.
by JavaFan (Canon) on Apr 27, 2012 at 13:10 UTC
    You and I must have a wildly different idea what is complicated.

    If you find a one-liner using a bog standard file iteration loop complicating, I wonder what you think of sort.

      1/k is certainly not complicated in the least.

      The proof that it is correct is trivial for a proof.

      The only part I can see that could be called complex is the fact that the algorithm is not immediately obvious and needs a proof. (Even if just an engineering "proof"-by-example.)

        The algorithm isn't immediately obvious?

        I'm sorry, but if that's the case, it will be true for almost all code posted on Perlmonks. Do note though that I did not post a proof of the algorithm. I posted a proof of the claim the algorithm was fair.

        I'd argue that the fact I was willing to actual write down a full proof in the crappy user interface a textbox is, is a proof that the proof is fairly trivial. Any claim of complexity or fairness needs a proof -- but we usually omit them because it's too much work to type it in (or to remember how it goes). "Everyone" knows sorting can be done in O(N log N) time, and that that bound is tight. But noone thinks the proof is easy enough to write down here - if they even know how to prove it. In fact, I claim most Perl programmers never prove anything about their programs, or their claims (although some may consider a test suite to be some kind of proof).