good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re^7: regex return true instead of false (precedence)by Marshall (Canon) |
on Aug 27, 2019 at 02:33 UTC ( [id://11105101]=note: print w/replies, xml ) | Need Help?? |
Well part of the point that I'm trying to make is that condition should change to make the logical sense of this easier to understand.
I was trained as a hardware engineer. DeMorgan's Theorem is an important part of hardware design. An AND or an OR gate is actually pretty rare. The most common gate is NAND, followed by NOR. The reason for that is that the fastest gates have a logical inversion - that is due to the way the hardware works. Inverting that output slows things down. Changing the formulation of condition can make things easier to understand. The compiler should generate similar code for the above examples. I just think that the second is easier for a human to understand.
In Section
Seekers of Perl Wisdom
|
|