Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^2: interpretation of "neither...nor"

by Zaxo (Archbishop)
on Jun 17, 2007 at 03:46 UTC ( [id://621651]=note: print w/replies, xml ) Need Help??


in reply to Re: interpretation of "neither...nor"

See DeMorgan's laws in formal logic. The solution is correct because (as truth tables will reveal),

! (defined $ENV{EDITOR} || defined $ENV{VISUAL})
is equivalent to,
(! defined $ENV{EDITOR} && ! defined $ENV{VISUAL})

After Compline,
Zaxo

Replies are listed 'Best First'.
Re^3: interpretation of "neither...nor"
by cgmd (Beadle) on Jun 17, 2007 at 15:50 UTC
    Thank you, Zaxo, for that reference.

    Following up, I have found:

    Augustus De Morgan originally observed that in classical propositional logic the following relationships hold:

    not (P and Q) = (not P) or (not Q)

    not (P or Q) = (not P) and (not Q)

    This explains why the following are equivalent instructions:

    print "no editor found\n" if ! (defined $ENV{EDITOR} || defined $ENV{VISUAL}); print "no editor found\n" if (!defined $ENV{EDITOR} && !defined $ENV{VISUAL});

    Thank you for setting me straight! This has been very helpful!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2024-04-19 23:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found