Notes (HPFP 09/31): Lists
9 Lists
9.5 Using ranges to construct lists
Exercise: EnumFromTo
9.6 Extracting portions of lists
Exercises: Thy Fearful Symmetry
9.7 List Comprehensions
Exercises: Comprehend Thy Lists
[4,15,36,64,100]
haskell [(1,1),(1,4),(1,9),(1,16),(1,25),(1,36),(1,49) ,(4,1),(4,4),(4,9),(4,16),(4,25),(4,36),(4,49) ,(9,1),(9,4),(9,9),(9,16),(9,25),(9,36),(9,49) ,(16,1),(16,4),(16,9),(16,16),(16,25),(16,36),(16,49) ,(25,1),(25,4),(25,9),(25,16),(25,25),(25,36),(25,49) ,(36,1),(36,4),(36,9),(36,16),(36,25),(36,36),(36,49) ,(49,1),(49,4),(49,9),(49,16),(49,25),(49,36),(49,49) ]
[(1,1),(1,4),(1,9),(1,16),(1,25)]
Exercises: Square Cube
9.8 Spines and nonstrict evaluation
Exercises: Bottom Madness
- bottom
- works
- bottom
- works
- bottom
- works
- bottom
- works
- works
- bottom
Intermission: Is it in normal form?
- WHNF & NF
- WHNF
- neither
- neither
- neither
- neither
- WHNF
9.9 Transforming lists
Exercises: More Bottoms
- bottom
- yes
- bottom
- Is this character a vowel?
itIsMystery :: Char -> Bool
- the first 10 square numbers
[1, 10, 20]
[15, 15, 15]
- see
FoldBool.hs