forked from carloseduardoweb/haskell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest2.hs
37 lines (27 loc) · 732 Bytes
/
test2.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
safetail :: [a] -> [a]
safetail xs = if null xs then [] else tail xs
safetail' :: [a] -> [a]
safetail' xs | null xs = []
| otherwise = tail xs
safetail'' :: [a] -> [a]
safetail'' [] = []
safetail'' (_:xs) = xs
or' :: Bool -> Bool -> Bool
or' True _ = True
or' _ True = True
or' _ _ = False
or'' :: Bool -> Bool -> Bool
or'' False False = False
or'' _ _ = True
or''' :: Bool -> Bool -> Bool
or''' False a = a
or''' True a = True
and' True True = True
and' _ _ = False
and'' :: Bool -> Bool -> Bool
and'' a b = if a == True && b == True then True else False
and''' :: Bool -> Bool -> Bool
and''' True b = b
and''' False _ = False
and'''' :: Bool -> Bool -> Bool
and'''' a b = if a == True then b else False