Spring 2001, CSE 428: Quiz 8.4 - 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) =  (f L) - x + 1;
    
    What is the result of f [0,1,2]; ? (only one answer, please)

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

  3. [Pts 2]  What is the result of the expression tl ["Luigi","Mario","Piero"]; (only one answer, please. Remember that tl represents the function "tail of a list".)

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