Chapter 3 Test Retake
-
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))
-
What class constraint allows you to take the logarithm of a variable?
-
(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