Spring 2001, CSE 428: Quiz 8.3 - 22 March 2001


Please write your Name and Student ID,at the top of the page.
By default, this quiz will be returned in Section 1 (afternoon section).
  1. [Pts 2] 

    Consider the definition

       fun f [] = 0
         | f (x::L) = x + (f L) - 1;
    
    What is the result of f [0,1,2]; ? (only one answer, please)

  2. [Pts 2]  What is the effect at the end of the following sequence of declarations? (only one answer, please)
       val x = 1;
       val y = 2;
       val (x,y) = (y,x);
    

  3. [Pts 2]  What is the result of the expression hd [[1],[2],[3]]; (only one answer, please. Remember that hd represents the function "head of a list".)

  4. [Pts 4]  Consider the following definition:
       fun app [] L = L
         | app (x::K) L = x::(app K L);
    
    For each of the following expressions, say what is the result, or say whether it's an error.