in reply to Re^5: When doesn't the flip-flop operator work in all scalar contexts?
in thread Why doesn't the flip-flop operator work in all scalar contexts?
How does it not fit that quoted statement?First of all that doesn't fit the man page
flip at 1? yes flop at 1? yes -> Would return false, but must return true once. flip at 2? yes flop at 2? yes -> Would return false, but must return true once. flip at 2? yes flop at 2? yes -> Would return false, but must return true once. flip at 2? yes flop at 2? yes -> Would return false, but must return true once. flip at 2? yes flop at 2? yes -> Would return false, but must return true once.
Secondly if you look at my third example above, [...] So it can't be a case of flip and flop on the same round, there never seems to be a flip
It flips, but it never flops because $y is always false.
my $x=1; my $y=0; for(1,2,3,4,5) { next if (printf("flip at %s? %s\n",$_,$x?'yes':'no'),$x) .. (printf("flop at %s? %s\n",$_,$y?'yes':'no'),$y); print "$_\n"; }
flip at 1? yes flop at 1? no -> Returns true. flop at 2? no -> Returns true. flop at 3? no -> Returns true. flop at 4? no -> Returns true. flop at 5? no -> Returns true.
Update: Truth tables for flip/flop:
| .. | ||||
|---|---|---|---|---|
| State | Flip | Flop | New State | Returns |
| out | yes | yes | out | true |
| out | yes | no | in | true |
| out | no | [not executed] | out | false |
| in | [not executed] | yes | out | false |
| in | [not executed] | no | in | true |
| ... | ||||
|---|---|---|---|---|
| State | Flip | Flop | New State | Returns |
| out | yes | [not executed] | in | true |
| out | no | [not executed] | out | false |
| in | [not executed] | yes | out | false |
| in | [not executed] | no | in | true |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: When doesn't the flip-flop operator work in all scalar contexts?
by jethro (Monsignor) on Oct 02, 2008 at 21:12 UTC |