You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
761 B
761 B
Chapter Exercises
length :: [a] -> Int
(Why notInteger
?)- Answers:
- 5
- 3
- 2
- 5
(/)
takes twoFractional
types.length
returns andInt
which is notFractional
. (Float
andDouble
are)- Use
div
instead:div 6 $ length [1, 2, 3]
Bool
.True
(Note:(+)
has higher precedence)Bool
.False
- Answers:
- Works.
Bool
.True
- Won't work. List needs to have elements of the same type.
- Works.
Int
.5
- Works.
Bool
.False
- Won't work.
(&&)
needs twoBool
's,9
isn't one.
- Works.
- see src/chapter4.hs
- see src/chapter4.hs
- see src/chapter4.hs
Correcting syntax
see src/chapter4.hs
Match the function names to their types
- (c)
- (b)
- (a)
- (d)