31 apply an automated marking script to them.\medskip |
31 apply an automated marking script to them.\medskip |
32 |
32 |
33 \noindent |
33 \noindent |
34 In addition, the Scala coursework comes with a reference implementation |
34 In addition, the Scala coursework comes with a reference implementation |
35 in form of \texttt{jar}-files. This allows you to run any test cases on |
35 in form of \texttt{jar}-files. This allows you to run any test cases on |
36 your own computer. For example you can call Scala on the command line |
36 your own computer. For example you can call scala-cli on the command line |
37 with the option \texttt{-cp collatz.jar} and then query any function |
37 with the option \texttt{--extra-jars collatz.jar} and then query any function |
38 from the template file. Say you want to find out what the functions |
38 from the template file. Say you want to find out what the functions |
39 \texttt{collatz} and \texttt{collatz\_max} produce: for this you just |
39 \texttt{collatz} and \texttt{collatz\_max} produce: for this you just |
40 need to prefix them with the object name \texttt{C1}. If you want to |
40 need to prefix them with the object name \texttt{C1}. If you want to |
41 find out what these functions produce for the argument \texttt{6}, you |
41 find out what these functions produce for the argument \texttt{6}, you |
42 would type something like: |
42 would type something like: |
43 |
43 |
44 \begin{lstlisting}[language={},numbers=none,basicstyle=\ttfamily\small] |
44 \begin{lstlisting}[language={},numbers=none,basicstyle=\ttfamily\small] |
45 $ scala -cp collatz.jar |
45 $ scala-cli --extra-jars collatz.jar |
46 |
46 |
47 scala> C1.collatz(6) |
47 scala> C1.collatz(6) |
48 ... |
48 ... |
49 scala> C1.collatz_max(6) |
49 scala> C1.collatz_max(6) |
50 ... |
50 ... |