Binary file cws/cw01.pdf has changed
--- a/cws/cw01.tex Sat Nov 02 15:11:30 2019 +0000
+++ b/cws/cw01.tex Sat Nov 02 19:07:19 2019 +0000
@@ -6,7 +6,7 @@
\begin{document}
-\section*{Assignment 6 (Scala)}
+\section*{Part 6 (Scala)}
\mbox{}\hfill\textit{``The most effective debugging tool is still careful thought,}\\
\mbox{}\hfill\textit{coupled with judiciously placed print statements.''}\smallskip\\
@@ -14,7 +14,7 @@
\noindent
-This assignment is about Scala. You are asked to implement two programs
+This part is about Scala. You are asked to implement two programs
about list processing and recursion. The preliminary part (3\%) is due
on \cwSIX{} at 4pm, and the core part on \cwSIXa{} at 4pm. The core
part is more advanced and might include material you have not yet seen
@@ -36,8 +36,8 @@
apply an automated marking script to them.\medskip
\noindent
-In addition, the Scala assignments come with a reference implementation
-in form of a \texttt{jar}-file. This allows you to run any test cases
+In addition, the Scala coursework comes with a reference implementation
+in form of \texttt{jar}-files. This allows you to run any test cases
on your own computer. For example you can call Scala on the command
line with the option \texttt{-cp collatz.jar} and then query any
function from the template file. Say you want to find out what
@@ -59,14 +59,14 @@
\subsection*{Hints}
\noindent
-\textbf{For Part 1:} useful math operators: \texttt{\%} for modulo; useful
+\textbf{For Preliminary Part:} useful math operators: \texttt{\%} for modulo; useful
functions: \mbox{\texttt{(1\,to\,10)}} for ranges, \texttt{.toInt},
\texttt{.toList} for conversions, \texttt{List(...).max} for the
maximum of a list, \texttt{List(...).indexOf(...)} for the first index of
a value in a list.\bigskip
\noindent
-\textbf{For Part 2:} useful string functions:
+\textbf{For Core Part:} useful string functions:
\texttt{.startsWith(...)} for checking whether a string has a given
prefix, \texttt{\_ ++ \_} for concatenating two strings; useful option
functions: \texttt{.flatten} flattens a list of options such that it
@@ -117,7 +117,7 @@
0.\footnote{While it is relatively easy to test this conjecture with
particular numbers, it is an interesting open problem to
\emph{prove} that the conjecture is true for \emph{all} numbers ($>
- 0$). Paul Erd\"o{}s, a famous mathematician you might have hard
+ 0$). Paul Erd\"o{}s, a famous mathematician you might have heard
about, said about this conjecture: ``Mathematics may not [yet] be ready
for such problems.'' and also offered a \$500 cash prize for its
solution. Jeffrey Lagarias, another mathematician, claimed that
@@ -188,7 +188,7 @@
a year, we invest our money in equal amounts in each of these
stocks. For example if we have \$100 and there are four stocks that
are traded in our portfolio, we buy \$25 worth of stocks
- from each. Be careful to also test cases where you trade with 3 stocks, for example.
+ from each. (Be careful to also test cases where you trade with 3 stocks.)
\item Next year in January, we look at how our stocks did, liquidate
everything, and re-invest our (hopefully) increased money in again
the stocks from our portfolio (there might be more stocks available,
@@ -203,7 +203,7 @@
data for such back-of-the-envelope calculations was freely available
online. Unfortunately nowadays this kind of data is more difficult to
obtain, unless you are prepared to pay extortionate prices or be
-severely rate-limited. Therefore this assignment comes with a number
+severely rate-limited. Therefore this part comes with a number
of files containing CSV-lists with the historical stock prices for the
companies in our portfolios. Use these files for the following
tasks.\bigskip
Binary file cws/cw02.pdf has changed
--- a/cws/cw02.tex Sat Nov 02 15:11:30 2019 +0000
+++ b/cws/cw02.tex Sat Nov 02 19:07:19 2019 +0000
@@ -7,7 +7,7 @@
\begin{document}
-\section*{Coursework 7 (Scala)}
+\section*{Part 7 (Scala)}
\mbox{}\hfill\textit{``What one programmer can do in one month,}\\
\mbox{}\hfill\textit{two programmers can do in two months.''}\smallskip\\
@@ -31,14 +31,14 @@
\subsection*{Reference Implementation}
-Like the C++ assignments, the Scala assignments will work like this: you
+Like the C++ part, the Scala part works like this: you
push your files to GitHub and receive (after sometimes a long delay) some
-automated feedback. In the end we take a snapshot of the submitted files and
+automated feedback. In the end we will take a snapshot of the submitted files and
apply an automated marking script to them.\medskip
\noindent
-In addition, the Scala assignments come with a reference
-implementation in form of a \texttt{jar}-file. This allows you to run
+In addition, the Scala part comes with reference
+implementations in form of \texttt{jar}-files. This allows you to run
any test cases on your own computer. For example you can call Scala on
the command line with the option \texttt{-cp docdiff.jar} and then
query any function from the template file. Say you want to find out
@@ -58,7 +58,7 @@
\subsection*{Hints}
\noindent
-\textbf{For Part 1:} useful operations involving regular
+\textbf{For Preliminary Part:} useful operations involving regular
expressions:
\[\texttt{reg.findAllIn(s).toList}\]
\noindent finds all
@@ -70,7 +70,7 @@
integers, \texttt{.max} calculates the maximum of a list.\bigskip
\noindent
-\textbf{For Part 2:} use \texttt{.split(",").toList} for splitting
+\textbf{For Core Part:} use \texttt{.split(",").toList} for splitting
strings according to commas (similarly $\backslash$\texttt{n}),
\texttt{.getOrElse(..,..)} allows to query a Map, but also gives a
default value if the Map is not defined, a Map can be `updated' by
Binary file cws/cw03.pdf has changed
--- a/cws/cw03.tex Sat Nov 02 15:11:30 2019 +0000
+++ b/cws/cw03.tex Sat Nov 02 19:07:19 2019 +0000
@@ -18,7 +18,7 @@
\mbox{}\\[-18mm]\mbox{}
-\section*{Coursework 8 (Scala)}
+\section*{Part 8 (Scala)}
\mbox{}\hfill\textit{``The problem with object-oriented languages is they’ve got all this implicit,}\\
\mbox{}\hfill\textit{environment that they carry around with them. You wanted a banana but}\\
@@ -26,7 +26,7 @@
\mbox{}\hfill\textit{ --- Joe Armstrong (creator of the Erlang programming language)}\medskip\bigskip
\noindent
-This coursework is about searching and backtracking. You are asked to
+This part is about searching and backtracking. You are asked to
implement Scala programs that solve various versions of the
\textit{Knight's Tour Problem} on a chessboard. The preliminary part is
due on \cwEIGHT{} at 4pm; the core part is due on \cwEIGHTa{} at 4pm.
@@ -159,7 +159,7 @@
\subsection*{Reference Implementation}
-This Scala assignment comes with three reference implementations in form of
+This Scala part comes with three reference implementations in form of
\texttt{jar}-files. This allows you to run any test cases on your own
computer. For example you can call Scala on the command line with the
option \texttt{-cp knight1.jar} and then query any function from the
--- a/cws/cw05.tex Sat Nov 02 15:11:30 2019 +0000
+++ b/cws/cw05.tex Sat Nov 02 19:07:19 2019 +0000
@@ -15,9 +15,9 @@
\section*{Coursework 10 (Scala)}
-%\mbox{}\hfill\textit{``What one programmer can do in one month,}\\
-%\mbox{}\hfill\textit{two programmers can do in two months.''}\smallskip\\
-%\mbox{}\hfill\textit{ --- Frederick P.~Brooks (author of The Mythical Man-Month)}\bigskip\medskip
+\mbox{}\hfill\textit{``If there's one feature that makes Scala,}\\
+\mbox{}\hfill\textit{`Scala', I would pick implicits.''}\smallskip\\
+\mbox{}\hfill\textit{ --- Martin Odersky (creator of the Scala language)}\bigskip\medskip
\noindent
Binary file solutions3/knight1.jar has changed
--- a/solutions3/knight1.scala Sat Nov 02 15:11:30 2019 +0000
+++ b/solutions3/knight1.scala Sat Nov 02 19:07:19 2019 +0000
@@ -154,7 +154,7 @@
// 15 secs for 8 x 8
//val ts1 = time_needed(0,first_tour(8, List((0, 0))).get)
-val ts1 = time_needed(0,first_tour(8, List((1, 1))).get)
+//val ts1 = time_needed(0,first_tour(8, List((1, 1))).get)
// no result for 4 x 4
//val ts2 = time_needed(0, first_tour(4, List((0, 0))))