cws/cw01.tex
changeset 195 fc3ac7b70a06
parent 192 a112e0e2325c
child 196 c50b074b3047
equal deleted inserted replaced
194:060b081523de 195:fc3ac7b70a06
     1 \documentclass{article}
     1 \documentclass{article}
     2 \usepackage{../style}
     2 \usepackage{../style}
       
     3 \usepackage{disclaimer}
     3 %%\usepackage{../langs}
     4 %%\usepackage{../langs}
     4 
     5 
     5 \begin{document}
     6 \begin{document}
     6 
     7 
     7 \section*{Coursework 6 (Scala)}
     8 \section*{Coursework 6 (Scala)}
     8  
     9  
     9 This coursework is about Scala and is worth 10\%. The first and second
    10 This coursework is about Scala and is worth 10\%. The first and second
    10 part are due on 16 November at 11pm, and the third part on 23 November
    11 part are due on 15 November at 11pm, and the third part on 20 December
    11 at 11pm. You are asked to implement three programs about list
    12 at 11pm. You are asked to implement three programs about list
    12 processing and recursion. The third part is more advanced and might
    13 processing and recursion. The third part is more advanced and might
    13 include material you have not yet seen in the first lecture.
    14 include material you have not yet seen in the lecture.
    14 Make sure the files you submit can be processed by just calling
    15 Make sure the files you submit can be processed by just calling
    15 \texttt{scala <<filename.scala>>}.\bigskip
    16 \texttt{scala <<filename.scala>>}.\bigskip
    16 
    17 
    17 \noindent
    18 \IMPORTANT{}
    18 \textbf{Important:} Do not use any mutable data structures in your
    19 
    19 submissions! They are not needed. This means you cannot use 
    20 
    20 \texttt{ListBuffer}s, for example. Do not use \texttt{return} in your
    21 \noindent
    21 code! It has a different meaning in Scala, than in Java.
    22 Also note that the running time of each part will be restricted to a
    22 Do not use \texttt{var}! This declares a mutable variable. Make sure the
    23 maximum of 60 seconds on my laptop.
    23 functions you submit are defined on the ``top-level'' of Scala, not
       
    24 inside a class or object. Also note that the running time of
       
    25 each part will be restricted to a maximum of 360 seconds on my laptop.
       
    26 
    24 
    27 
    25 
    28 \subsection*{Disclaimer}
    26 \subsection*{Disclaimer}
    29 
    27 
    30 It should be understood that the work you submit represents
    28 It should be understood that the work you submit represents
    31 your own effort. You have not copied from anyone else. An
    29 your own effort. You have not copied from anyone else. An
    32 exception is the Scala code I showed during the lectures or
    30 exception is the Scala code I showed during the lectures or
    33 uploaded to KEATS, which you can freely use.\bigskip
    31 uploaded to KEATS, which you can freely use. If you want to
       
    32 look up anything from the Scala library, the link to the api
       
    33 is
       
    34 
       
    35 \begin{center}
       
    36 \url{http://www.scala-lang.org/api/current/}
       
    37 \end{center}  
       
    38 
       
    39 \noindent
       
    40 I usually google for things like \texttt{scala} \texttt{library} \texttt{groupBy}
       
    41 and click on the link about the Scala Standard Library for more information.
       
    42 \bigskip
    34 
    43 
    35 
    44 
    36 \subsection*{Part 1 (3 Marks)}
    45 \subsection*{Part 1 (3 Marks)}
    37 
    46 
    38 This part is about recursion. You are asked to implement a Scala
    47 This part is about recursion. You are asked to implement a Scala
    62 As you can see, the numbers go up and down like a roller-coaster, but
    71 As you can see, the numbers go up and down like a roller-coaster, but
    63 curiously they seem to always terminate in $1$. The conjecture is that
    72 curiously they seem to always terminate in $1$. The conjecture is that
    64 this will \emph{always} happen for every number greater than
    73 this will \emph{always} happen for every number greater than
    65 0.\footnote{While it is relatively easy to test this conjecture with
    74 0.\footnote{While it is relatively easy to test this conjecture with
    66   particular numbers, it is an interesting open problem to
    75   particular numbers, it is an interesting open problem to
    67   \emph{prove} that the conjecture is true for \emph{all} numbers ($>
    76   \emph{prove} that the conjecture is true for \emph{all} numbers
    68   0$). Paul Erd\"o{}s, a famous mathematician you might have hard
    77   ($> 0$). Paul Erd\"o{}s, a famous mathematician you might have hard
    69   about, said about this conjecture: ``Mathematics may not be ready
    78   about, is quoted to have said about this conjecture: ``Mathematics
    70   for such problems.'' and also offered a \$500 cash prize for its
    79   is not yet ripe enough for such questions.''  and also offered a
    71   solution. Jeffrey Lagarias, another mathematician, claimed that
    80   \$500 cash prize for its solution. Jeffrey Lagarias, another
    72   based only on known information about this problem, ``this is an
    81   mathematician, claimed that based only on known information about
    73   extraordinarily difficult problem, completely out of reach of
    82   this problem, ``this is an extraordinarily difficult problem,
    74   present day mathematics.'' There is also a
    83   completely out of reach of present day mathematics.'' There is also
    75   \href{https://xkcd.com/710/}{xkcd} cartoon about this conjecture
    84   a \href{https://xkcd.com/710/}{xkcd} cartoon about this conjecture
    76   (click \href{https://xkcd.com/710/}{here}). If you are able to solve
    85   (click \href{https://xkcd.com/710/}{here}). If you are able to solve
    77   this conjecture, you will definitely get famous.}\bigskip
    86   this conjecture, you will definitely get famous.}\bigskip
    78 
    87 
    79 \newpage
    88 \newpage
    80 \noindent
    89 \noindent