Skip to content

Commit 0718715

Browse files
committed
Update my answers in ch4
1 parent 62711fa commit 0718715

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

ch4/ex1.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
Exercises: Mood Swing
2+
13
Given,
24

35
data Mood = Blah | Woot deriving Show

ch4/ex2.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
1. not True && True
2-
2. not (x == 6)
2+
2. not (x == 6) ; N.B. x is not in scope
33
3. (1 * 2) > 5
44
4. "Merry" > "Happy"
55
5. [1, 2, 3] ++ "look at me!" ; The lists contain different types

ch4/ex3.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
Chapter Exercises
2+
13
1. length :: [a] -> Int
24
2. a) 5
35
b) 3
@@ -11,8 +13,8 @@ However,
1113

1214
6 / length [1, 2, 3] will return an error.
1315

14-
Why? length [1, 2, 3] :: Int, but Int does not implement an instance of the
15-
Fractional typeclass.
16+
Why? length [1, 2, 3] :: Int, but Int is not an instance of the Fractional
17+
typeclass.
1618

1719
4. div 6 (length [1, 2, 3])
1820

@@ -53,7 +55,7 @@ myAbs n = if n >= 0 then n else (negate n)
5355
f :: (a, b) -> (c, d) -> ((b, d), (a, c))
5456
f x y = ((snd x, snd y), (fst x, fst y))
5557

56-
Reading Syntax
58+
Correcting Syntax
5759

5860
See syntax.hs
5961

0 commit comments

Comments
 (0)