http://www.perlmonks.org?node_id=927691


in reply to Re: An exploration of higher-level-language approaches to the "First all-zero row in an NxN matrix" problem (goto Considered Harmful)
in thread An exploration of higher-level-language approaches to the "First all-zero row in an NxN matrix" problem (goto Considered Harmful)

But how many individual values are tested? (Ie. grep will examine an entire row even if the first value in that row is non-zero. Etc.)


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
  • Comment on Re^2: An exploration of higher-level-language approaches to the "First all-zero row in an NxN matrix" problem (goto Considered Harmful)
  • Watch for: Direct replies / Any replies

Replies are listed 'Best First'.
Re^3: An exploration of higher-level-language approaches to the "First all-zero row in an NxN matrix" problem (goto Considered Harmful)
by johngg (Canon) on Sep 25, 2011 at 11:36 UTC

    I think I've seen it written somewhere that List::Util->first() will efficiently break out as soon as it finds the first item that passes the condition rather than testing all of the items. I've tried to confirm this by looking at the module source but failed to find the relevant code :-s

    Cheers,

    JohnGG