Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,18 @@
|
|||
module ShortCircuit where
|
||||
|
||||
import Prelude hiding ((&&), (||))
|
||||
import Debug.Trace
|
||||
|
||||
False && _ = False
|
||||
True && False = False
|
||||
_ && _ = True
|
||||
|
||||
True || _ = True
|
||||
False || True = True
|
||||
_ || _ = False
|
||||
|
||||
a p = trace ("<a " ++ show p ++ ">") p
|
||||
b p = trace ("<b " ++ show p ++ ">") p
|
||||
|
||||
main = mapM_ print ( [ a p || b q | p <- [False, True], q <- [False, True] ]
|
||||
++ [ a p && b q | p <- [False, True], q <- [False, True] ])
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
_ && False = False
|
||||
False && True = False
|
||||
_ && _ = True
|
||||
|
||||
_ || True = True
|
||||
True || False = True
|
||||
_ || _ = False
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
p && q = case p of
|
||||
False -> False
|
||||
_ -> case q of
|
||||
False -> False
|
||||
_ -> True
|
||||
|
||||
p || q = case p of
|
||||
True -> True
|
||||
_ -> case q of
|
||||
True -> True
|
||||
_ -> False
|
||||
Loading…
Add table
Add a link
Reference in a new issue