cws/main_cw04.tex
changeset 356 d1046d9d3213
parent 355 bc3980949af2
child 372 e87462c9b895
equal deleted inserted replaced
355:bc3980949af2 356:d1046d9d3213
    16                hlabelformat=\arabic{ranklabel},
    16                hlabelformat=\arabic{ranklabel},
    17                vlabelformat=\arabic{filelabel}}
    17                vlabelformat=\arabic{filelabel}}
    18 
    18 
    19 \mbox{}\\[-18mm]\mbox{}
    19 \mbox{}\\[-18mm]\mbox{}
    20 
    20 
    21 \section*{Preliminary and Core Part 9 (Scala, 4 + 6 Marks)}
    21 \section*{Preliminary and Main Part 4 (Scala, 4 + 6 Marks)}
    22 
    22 
    23 \mbox{}\hfill\textit{``The problem with object-oriented languages is they’ve got all this implicit,}\\
    23 \mbox{}\hfill\textit{``The problem with object-oriented languages is they’ve got all this implicit,}\\
    24 \mbox{}\hfill\textit{environment that they carry around with them. You wanted a banana but}\\
    24 \mbox{}\hfill\textit{environment that they carry around with them. You wanted a banana but}\\
    25 \mbox{}\hfill\textit{what you got was a gorilla holding the banana and the entire jungle.''}\smallskip\\
    25 \mbox{}\hfill\textit{what you got was a gorilla holding the banana and the entire jungle.''}\smallskip\\
    26 \mbox{}\hfill\textit{ --- Joe Armstrong (creator of the Erlang programming language)}\medskip\bigskip
    26 \mbox{}\hfill\textit{ --- Joe Armstrong (creator of the Erlang programming language)}\medskip\bigskip
   204 anonymous functions can be constructed using \texttt{(x:Int) => ...},
   204 anonymous functions can be constructed using \texttt{(x:Int) => ...},
   205 this function takes an \texttt{Int} as an argument.\medskip
   205 this function takes an \texttt{Int} as an argument.\medskip
   206 
   206 
   207 
   207 
   208 \noindent
   208 \noindent
   209 \textbf{Core Part} a useful list function: \texttt{.sortBy} sorts a list
   209 \textbf{Main Part} a useful list function: \texttt{.sortBy} sorts a list
   210 according to a component given by the function; a function can be
   210 according to a component given by the function; a function can be
   211 tested to be tail-recursive by annotation \texttt{@tailrec}, which is
   211 tested to be tail-recursive by annotation \texttt{@tailrec}, which is
   212 made available by importing \texttt{scala.annotation.tailrec}.\medskip
   212 made available by importing \texttt{scala.annotation.tailrec}.\medskip
   213 
   213 
   214 
   214