updated
authorChristian Urban <christian.urban@kcl.ac.uk>
Thu, 04 Nov 2021 12:20:12 +0000
changeset 395 017f621f5835
parent 394 839ad118e467
child 396 3ffe978a5664
updated
handouts/pep-ho.pdf
handouts/pep-ho.tex
Binary file handouts/pep-ho.pdf has changed
--- a/handouts/pep-ho.tex	Fri Jul 16 23:34:19 2021 +0100
+++ b/handouts/pep-ho.tex	Thu Nov 04 12:20:12 2021 +0000
@@ -107,7 +107,7 @@
 
     
 \begin{document}
-\fnote{\copyright{} Christian Urban, King's College London, 2017, 2018, 2019, 2020}
+\fnote{\copyright{} Christian Urban, King's College London, 2017, 2018, 2019, 2020, 2021}
 
 %\begin{tcolorbox}[breakable,size=fbox,boxrule=1pt,pad at break*=1mm,colback=cellbackground,colframe=cellborder]
 %  abd
@@ -150,6 +150,12 @@
 \url{http://www.scala-lang.org}\medskip
 \end{quote}
 
+\noindent\alert
+Just make sure you are downloading the ``battle tested'' version of
+Scala \textbf{2.13} This is the one I am going to use in the lectures and
+in the coursework. The newer Scala 3.0 \& 3.1 still have some
+features not fully implemented.\bigskip
+
 \noindent
 If you are interested, there are also experimental backends of Scala
 for producing code under Android (\url{http://scala-android.org}); for
@@ -1621,9 +1627,11 @@
 
 %\subsection*{Coursework}
 
+\begin{figure}[p]
+\begin{boxedminipage}{\textwidth}  
+\textbf{Scala Syntax for Java Developers}\bigskip
 
-\subsection*{Scala Syntax for Java Developers}
-
+\noindent
 Scala compiles to the JVM, like the Java language. Because of this,
 it can re-use many libraries. Here are a few hints how some Java code
 tranlsates to Scala code:\bigskip
@@ -1639,6 +1647,13 @@
 \end{lstlisting}
 
 \noindent
+or even
+
+\begin{lstlisting}[language=Scala]
+val coke = getCoke()/*!\annotation{Scala}!*/
+\end{lstlisting}\bigskip
+
+\noindent
 Unit means void:
 
 \begin{lstlisting}[language=Java]
@@ -1649,7 +1664,7 @@
 
 \begin{lstlisting}[language=Scala]
 def output(s: String): Unit = println(s)/*!\annotation{Scala}!*/
-\end{lstlisting}
+\end{lstlisting}\bigskip
 
 \noindent
 Type for list of Strings:
@@ -1660,7 +1675,7 @@
 
 \begin{lstlisting}[language=Scala]
 List[String]/*!\annotation{Scala}!*/
-\end{lstlisting}
+\end{lstlisting}\bigskip
 
 \noindent
 String interpolations
@@ -1672,10 +1687,10 @@
 
 \begin{lstlisting}[language=Scala]
 println(s"Hello, $first $last!")/*!\annotation{Scala}!*/
-\end{lstlisting}
+\end{lstlisting}\bigskip
 
 \noindent
-Java provides syntactic some sugar when constructing anonymous functions:
+Java provides some syntactic sugar when constructing anonymous functions:
 
 \begin{lstlisting}[language=Java]
 list.foreach(item -> System.out.println("* " + item));
@@ -1688,6 +1703,8 @@
 \begin{lstlisting}[language=Scala]
 list.foreach(item => println(s"* $item"))/*!\annotation{Scala}!*/
 \end{lstlisting}%$
+\end{boxedminipage}
+\end{figure}
 
 %%new / vs case classes