Quiz Stuff

Quiz 3; January 30; 3:30 minutes; 1+2+1+1+1 points

  1. Rewrite the following expression, removing unnecessary parentheses:
    f(x) + g(y) + (3*y)
    
  2. Rewrite the following function to use guards instead of if-else:
    f x = if x > 3 then 10 else x
    
  3. Add parentheses to the following type expression to reflect the associativity of ->
    a -> Int -> Char
    
  4. Recall that the head function returns the first element of a list. What is the type of head?
  5. What's the value of the following expression? tail [3, 1, 5]
EC ½ point: What's the difference between Int and Num?

EC ½ point: :info ++ shows infixr 5 ++. What's interesting about that?