Chapter 3 Quiz 1

  1. Write a good (technically correct) type signature for

    1. f(x) = x*(x+1)
    2. g(xs) = [ x/7 | x <- xs ]
    3. h(x) = "You told me "++(show x)
    4. k(x,y) = y*x - 5
  2. Write a function to extract an integer from one string and output a list containing the second string repeated that many times.

    prob2 "5" "dog" == ["dog","dog","dog","dog","dog"]
  1. Given two strings containing floating point numbers, return the sum of those numbers.
    prob3 "3.14" "2.81" == 5.95
  1. The root mean square of a list of numbers is the square root of the average of the squares of the numbers. Write a function to find the RMS of a list of floating point numbers.
     -- results are approximate
     prob4 [1, 10, 100] == 58.0259 
     prob4 [3.14, 2.81] == 2.979
  1. The mode of a list of integers is the number that appears the most often. Write a function to find the mode of a list of integers.
     prob5 [1,1,1,2,2,2,2,2,3,3] == 2
     prob5 [1,1,1,2,2,2] == 1 -- any one of the modes is ok
Last modified August 18, 2023: 2022-2023 End State (7352e87)