Chapter 4 Summary
patterns, guards, where, let, case
- patterns
f [] = 0
f (x:xs) = x + f xs
- guards
numword x
| x < 0 = "Negative"
| x == 0 = "Zero"
| otherwise = "Positive"
- where
h x = constant * x
where constant = 100
- let
yis65 x = let (parabola = 10 * x * x + 25) in parabola == 65
- case
numit value = case (value) of
5 -> "Five"
4 -> "Four"
_ -> "Something else"