ex5.2.hs 297 B

12345678910
  1. -- Exercise 5.2
  2. -- George C. Privon
  3. -- 2024-07-20
  4. sndItem0 :: [a] -> a
  5. sndItem0 ys = if length ys == 0
  6. then error "Empty list has no second element."
  7. else if length ys == 1
  8. then error "1-item list has no 2nd item."
  9. else ys !! 1