Chapter 3 Test Retake

  1. Use class constraints to write a general signature for the function below.

    demo x y z = 
      "The answer to " ++ (show x) ++ " + " ++ y ++ " is " ++
        show(sqrt(z))
    
  2. What class constraint allows you to take the logarithm of a variable?

  3. (Aim for a Length). Given a list of strings (“words”) and a list of integers (the lengths), return true if every second string in the list has a length in the list of lengths. Otherwise return false.

    Start by checking the very first word in the list.

    aimForLength ["a","quick","brown","fox","jumps!"] [1,5,6] == True
    aimForLength ["a","quick","brown","fox","jumps!"] [5,6,1] == True
    aimForLength ["a","quick","brown","fox","jumps!"] [5,6,1] == True
    aimForLength ["a","quick","brown","fox","jumps!"] [5,3,1] == False
    
Last modified August 18, 2023: 2022-2023 End State (7352e87)