Notes (HPFP 09/31): Lists

9 Lists

9.5 Using ranges to construct lists

Exercise: EnumFromTo

see EnumFromTo.hs

9.6 Extracting portions of lists

Exercises: Thy Fearful Symmetry

see FearfulSymmetry.hs

9.7 List Comprehensions

Exercises: Comprehend Thy Lists

  1. [4,15,36,64,100]
  2. [(1,1),(1,4),(1,9),(1,16),(1,25)]

Exercises: Square Cube

see SquareCube.hs

9.8 Spines and nonstrict evaluation

Exercises: Bottom Madness

  1. bottom
  2. works
  3. bottom
  4. works
  5. bottom
  6. works
  7. bottom
  8. works
  9. works
  10. bottom

Intermission: Is it in normal form?

  1. WHNF & NF
  2. WHNF
  3. neither
  4. neither
  5. neither
  6. neither
  7. WHNF

9.9 Transforming lists

Exercises: More Bottoms

  1. bottom
  2. yes
  3. bottom
  4. Is this character a vowel? itIsMystery :: Char -> Bool
    1. the first 10 square numbers
    2. [1, 10, 20]
    3. [15, 15, 15]
  5. see FoldBool.hs

9.10 Filtering lists of values

Exercises: Filtering

see Filtering.hs

Zipping exercises

see ZippingExercises.hs

9.12 Chapter Exercises

Data.Char

see CharExercises.hs

Ciphers

see Cipher.hs

Writing your own standard functions

see StdFunc.hs

9.14 Follow-up resources

  1. Data.List documentation for the base library.

  2. Ninety-nine Haskell problems.