# HG changeset patch # User Christian Urban # Date 1606260981 0 # Node ID 24f86eb53259f0d9db2f58a7332920112885ecfc # Parent d2f895c1dba697ac33ec9148c192cf60471ea70c updated diff -r d2f895c1dba6 -r 24f86eb53259 cws/pre_cw03.tex --- a/cws/pre_cw03.tex Tue Nov 24 09:04:06 2020 +0000 +++ b/cws/pre_cw03.tex Tue Nov 24 23:36:21 2020 +0000 @@ -55,6 +55,16 @@ \end{lstlisting}%$ +\subsection*{Hints} + +\noindent +\textbf{For the Preliminary Part:} useful operations for determining +whether a string is a number are \texttt{.forall} and \texttt{.isDigit}. +One way to calculate the the power operation is to use \texttt{.pow} +on \texttt{BigInt}s, like \texttt{BigInt(n).pow(m).toInt}. +\bigskip + + \subsection*{Preliminary Part (3 Marks, files postfix.scala, postfix2.scala)} The \emph{Shunting Yard Algorithm} has been developed by Edsger Dijkstra, diff -r d2f895c1dba6 -r 24f86eb53259 progs/lecture1.scala --- a/progs/lecture1.scala Tue Nov 24 09:04:06 2020 +0000 +++ b/progs/lecture1.scala Tue Nov 24 23:36:21 2020 +0000 @@ -482,6 +482,20 @@ +// Regular Expressions (the built in ones) + +val s = """Any so-called "politician" should respect a vote.""" +print(s) + +print("""foo""") + +val reg = """\d+""".r + +reg.findAllIn("bbbbaaabbbaaaccc").toList +reg.replaceAllIn("bbbbaaabbbaaaccc", "*") +reg.replaceAllIn("bbbb0aaa1bbba2aac3cc", "_") +reg.replaceAllIn("bbbb00aaa11bbba232aac33cc", "_") + // Further Information //===================== diff -r d2f895c1dba6 -r 24f86eb53259 progs/lecture2.scala --- a/progs/lecture2.scala Tue Nov 24 09:04:06 2020 +0000 +++ b/progs/lecture2.scala Tue Nov 24 23:36:21 2020 +0000 @@ -5,7 +5,6 @@ // String Interpolations //======================= - def cube(n: Int) : Int = n * n * n val n = 3 diff -r d2f895c1dba6 -r 24f86eb53259 slides/slides03.pdf Binary file slides/slides03.pdf has changed diff -r d2f895c1dba6 -r 24f86eb53259 slides/slides03.tex --- a/slides/slides03.tex Tue Nov 24 09:04:06 2020 +0000 +++ b/slides/slides03.tex Tue Nov 24 23:36:21 2020 +0000 @@ -354,6 +354,9 @@ % \end{frame} % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\begin{frame}<1-10> +\end{frame} + \end{document}