-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlec4.hs
More file actions
29 lines (23 loc) · 708 Bytes
/
lec4.hs
File metadata and controls
29 lines (23 loc) · 708 Bytes
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
guess 42 = "correct"
guess _ = "bullshits"
isPal "" = True
isPal (x:xs) = (x == last xs) && isPal (init xs)
head (x:_) = x
head [] = error "WTF"
guessMyAge x
| x > 27 = "too hight!"
| x < 27 = "too low!"
| True = "bingo!"
head' xs
| null xs = error "bitch!"
| otherwise = xs !! 0
slope (x1, y1) (x2, y2) = let dy = y2 - y1
dx = x2 - x1
in dy / dx
slope2 (x1, y1) (x2, y2) = dy / dx
where dy = y2 - y1
dx = x2 - x1
convert n unit
| n "m" = (n*1.09361, "yd")
| n "L" = (n/0.264172, "gal")
| n "kg" = (n*2.20462, "lb")