Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: Argument "" Isn't numeric in numeric eq (==)

by Not_a_Number (Parson)
on Feb 09, 2014 at 21:27 UTC ( #1074165=note: print w/ replies, xml ) Need Help??

in reply to Argument "" Isn't numeric in numeric eq (==)

I am trying to get the count of lines with successful cases (1,1) and lines with failed cases (1,2).

Not enough information:

  • Is 112 a success or a fail (and why)?
  • Do the tuples (1,1) and (1,2) have to be contiguous (is 13167 a success or a fail)?
  • Does order matter (is 2115 a success or a fail)?

Comment on Re: Argument "" Isn't numeric in numeric eq (==)
Replies are listed 'Best First'.
Re^2: Argument "" Isn't numeric in numeric eq (==)
by Kenosis (Priest) on Feb 09, 2014 at 22:02 UTC

    The OP's code answers these questions.

    Given the OP's dataset:

    1,1,,,, 1,2,,,, 3,4,1,1,, 1,1,1,1,, 5,6,3,4,1,2 1,1,,,, 1,1,1,1,1,1

    the code indicates that "Success" obtains when at least one of the following tuples is '1,1' and "Fail" obtains when one is '1,2':

    (n,n),(n,n),(n,n) ^ ^ ^ | | | | | + - Tuple 3 | + - Tuple 2 + - Tuple 1

    Edit: Added the "Fail" condition. Thank you, Jim.

      Read the OP again. There's both a "success case" (1,1) and a "fail case" (1,2), and they're independent. There's nothing in the specification of the problem that precludes the possibility of both a success case and a fail case in the same three-tuple record. As it happens, there isn't an example in the OP of a record that has both a success case and a fail case in it. So the record ,,,,, has neither a success case nor a fail case in it, and the record 1,1,1,2,1,2 has one success case and two fail cases in it. However, the specification is to count the number of records that have success cases and fail cases in them, not the number of such cases.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (7)
As of 2016-02-08 07:33 GMT
Find Nodes?
    Voting Booth?

    How many photographs, souvenirs, artworks, trophies or other decorative objects are displayed in your home?

    Results (268 votes), past polls