updated
authorChristian Urban <urbanc@in.tum.de>
Thu, 10 Nov 2016 10:40:05 +0000
changeset 33 b6cb302633eb
parent 32 45557ad18ea6
child 34 40424bbe109e
updated
progs/lecture1.scala
slides/slides01.pdf
slides/slides01.tex
--- a/progs/lecture1.scala	Thu Nov 10 04:02:45 2016 +0000
+++ b/progs/lecture1.scala	Thu Nov 10 10:40:05 2016 +0000
@@ -20,8 +20,9 @@
 (1 until 10).toList
 
 // an element in a list
-List(1, 2, 3, 1)(0)
-List(1, 2, 3, 1)(3)
+val lst = List(1, 2, 3, 1)
+lst(0)
+lst(2)
 
 1::2::3::Nil
 List(1, 2, 3) ::: List(4, 5, 6)
@@ -31,8 +32,7 @@
 
 println("test")
 
-
-val tst = "This is a " ++ "test\n" 
+val tst = "This is a " + "test\n" 
 println(tst)
 
 val lst = List(1,2,3,1)
@@ -40,6 +40,8 @@
 println(lst.toString)
 println(lst.mkString("\n"))
 
+println(lst.mkString(", "))
+
 // some methods take more than one argument
 println(lst.mkString("[", ",", "]"))
 
Binary file slides/slides01.pdf has changed
--- a/slides/slides01.tex	Thu Nov 10 04:02:45 2016 +0000
+++ b/slides/slides01.tex	Thu Nov 10 10:40:05 2016 +0000
@@ -79,11 +79,14 @@
 \frametitle{Why Scala?}
 
 \begin{itemize}
-\item compiles to the JVM (also JavaScript, X86)\medskip
+\item compiles to the JVM\\ (also JavaScript, native X86 in the works)\medskip
 \item integrates seamlessly with Java\medskip
-\item combines {\bf functional} and {\bf object-oriented} programming\medskip
-\item allows often to write more elegant code
-\end{itemize}  
+\item combines \underline{\bf functional} and {\bf object-oriented} programming\bigskip
+\item often one can write very concise and elegant code
+\end{itemize}\bigskip\medskip  
+
+\small
+alternatives: Elm, Haskell, Ocaml, ML, Lisp (Racket), \ldots
 
 \end{frame}
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
@@ -95,31 +98,45 @@
 {\lstset{language=java}\fontsize{12}{12}\selectfont
 \texttt{\lstinputlisting{Point.java}}}
 
+\rule{11cm}{0.3mm}\\[-2mm]
+
 {\lstset{language=scala}\fontsize{12}{12}\selectfont
 \texttt{\lstinputlisting{Point.scala}}}
 
 \begin{textblock}{6}(13,3)
 \textbf{\large Java}
-\end{textblock}  
+\end{textblock}
+
 
-\begin{textblock}{6}(13,13.2)
+
+\begin{textblock}{6}(13,13.4)
 \textbf{\large Scala}
 \end{textblock}  
 
 \end{frame}
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
 
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\begin{frame}[c]
+\frametitle{Scala Tools}
 
+\begin{itemize}
+\item there is a plugin for Eclipse (called Scala IDE)\medskip
+\item there is also a plugin for IntelliJ\bigskip
+\item I use the venerable Emacs ;o)
+\end{itemize}  
+
+\end{frame}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \begin{frame}[c]
 \frametitle{Types}
 
 \begin{itemize}
-\item Base types
+\item Base types\smallskip
 
-  \begin{center}
-  \begin{tabular}{l}
+  \begin{tabular}{@{}l@{}}
     \textcolor{codegreen}{\texttt{Int}},
     \textcolor{codegreen}{\texttt{Long}},
     \textcolor{codegreen}{\texttt{BigInt}},
@@ -129,12 +146,10 @@
     \textcolor{codegreen}{\texttt{Char}}\\
     \textcolor{codegreen}{\texttt{Boolean}}
   \end{tabular}
-  \end{center}
 
-\item Compound types    
+\item Compound types \smallskip   
 
-  \begin{center}
-  \begin{tabular}{ll}
+  \begin{tabular}{@{}ll@{}}
     \textcolor{codegreen}{\texttt{List[Int]}}     & lists of Int's \\
     \textcolor{codegreen}{\texttt{Set[Double]}}   & sets of Double's \\
     \textcolor{codegreen}{\texttt{(Int, String)}} & Int-String pair\\
@@ -143,7 +158,6 @@
                                       & pairs\\
     \textcolor{codegreen}{\texttt{List[List[Int]]}} & list of lists of Int's\\                                  
   \end{tabular}
-  \end{center}
 
 \end{itemize}  
 
@@ -188,9 +202,6 @@
 \end{frame}
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
 
-  
-
-
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \begin{frame}[c]
 
@@ -204,6 +215,29 @@
 \end{frame}
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
 
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\begin{frame}[c]
+\frametitle{Conclusion}
+
+\begin{itemize}
+\item Scala is still under heavy development\\ (the compiler is terribly slow)\medskip
+\item {\bf\url{http://www.scala-lang.org/}}\bigskip
+\item it is a rather \textbf{\alert{deep}} language\ldots i.e.~gives you a lot of
+  rope to shoot yourself\bigskip\bigskip 
+
+\item hope you have fun with the coursework  
+\end{itemize}
+\end{frame}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\begin{frame}[c]
+\frametitle{\begin{tabular}{c}\\[3cm]\alert{Questions?}\end{tabular}}
+
+\mbox{}
+\end{frame}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
+\end{document}
 
 
 \end{document}