equal
  deleted
  inserted
  replaced
  
    
    
    21   | 
    21   | 
    22 \item Consider the following Scala snippet. Are the two functions  | 
    22 \item Consider the following Scala snippet. Are the two functions  | 
    23 \texttt{is\_even} and \texttt{is\_odd} tail-recursive?      | 
    23 \texttt{is\_even} and \texttt{is\_odd} tail-recursive?      | 
    24   | 
    24   | 
    25 \begin{lstlisting}[numbers=none] | 
    25 \begin{lstlisting}[numbers=none] | 
    26 def iseven(n: Int) : Boolean = { | 
    26 def is_even(n: Int) : Boolean = { | 
    27     if (n == 0) true else isodd(n - 1)  | 
    27     if (n == 0) true else is_odd(n - 1)  | 
    28 }  | 
    28 }  | 
    29   | 
    29   | 
    30 def isodd(n: Int) : Boolean = { | 
    30 def is_odd(n: Int) : Boolean = { | 
    31     if (n == 0) false   | 
    31     if (n == 0) false   | 
    32     else if (n == 1) true else iseven(n - 1)  | 
    32     else if (n == 1) true else is_even(n - 1)  | 
    33 }  | 
    33 }  | 
    34 \end{lstlisting} | 
    34 \end{lstlisting} | 
    35         | 
    35         | 
    36 Do they cause stack-overflows when compiled to the JVM (for example by Scala)?  | 
    36 Do they cause stack-overflows when compiled to the JVM (for example by Scala)?  | 
    37   | 
    37   |