updated
authorChristian Urban <urbanc@in.tum.de>
Wed, 09 Nov 2016 13:09:38 +0000
changeset 23 8ac886bb0c15
parent 22 9830203b058d
child 24 66b97f9a40f8
updated
progs/lecture1.scala
slides/slides01.pdf
slides/slides01.tex
--- a/progs/lecture1.scala	Wed Nov 09 06:02:55 2016 +0000
+++ b/progs/lecture1.scala	Wed Nov 09 13:09:38 2016 +0000
@@ -20,9 +20,11 @@
 (1 until 10).toList
 
 // an element in a list
-List(1,2,3,1)(0)
-List(1,2,3,1)(3)
+List(1, 2, 3, 1)(0)
+List(1, 2, 3, 1)(3)
 
+1::2::3::Nil
+List(1, 2, 3) ::: List(4, 5, 6)
 
 //**Printing/Strings**
 //====================
@@ -52,7 +54,7 @@
 //**Types**
 //=========
 
-// Int, Long, BigInt
+// Int, Long, BigInt, Float, Double
 // String, Char
 // List[Int], Set[Double]
 // Pairs: (Int, String)        
@@ -61,7 +63,23 @@
 
 //**Smart Strings**
 //=================
-""" """
+println(">\n<")
+println(""">\n<""")
+
+/* in Java
+val lyrics = "Baa, Baa, Black Sheep \n" +
+             "Have you any wool? \n" +
+             "Yes, sir, yes sir \n" +
+             "Three bags full"
+*/ 
+
+val lyrics = """Baa, Baa, Black Sheep  
+                |Have you any wool?
+                |Yes, sir, yes sir
+                |Three bags full""".stripMargin
+
+println(lyrics)
+
 
 //**Pairs/Tuples**
 //================
Binary file slides/slides01.pdf has changed
--- a/slides/slides01.tex	Wed Nov 09 06:02:55 2016 +0000
+++ b/slides/slides01.tex	Wed Nov 09 13:09:38 2016 +0000
@@ -49,13 +49,19 @@
 \begin{frame}[c]
 \frametitle{Why Scala?}
 
-\begin{textblock}{6}(1,3)
+\begin{textblock}{6}(3,4)
 \begin{tabular}{l}
 \mbox{}\hspace{-1mm}\includegraphics[scale=0.36]{../pics/twitter.png}\\[-1mm]
 \includegraphics[scale=0.30]{../pics/linked.png}\\
 \includegraphics[scale=0.30]{../pics/guardian.jpg}\\[-3mm]
 \mbox{}\hspace{-2mm}\includegraphics[scale=0.38]{../pics/morgan.png}\\[-3mm]
 \includegraphics[scale=0.30]{../pics/suisse.png}\\
+{\large\bf ...}
+\end{tabular}
+\end{textblock}
+
+\begin{textblock}{6}(9,4)
+\begin{tabular}{l}
 \includegraphics[scale=0.20]{../pics/edf.png}\\[-1mm]
 \includegraphics[scale=0.08]{../pics/novell.png}\\[-1mm]
 \includegraphics[scale=0.30]{../pics/foursquare.png}\\
@@ -67,7 +73,56 @@
 \end{frame}
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
 
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\begin{frame}[c]
+\frametitle{Why Scala?}
+
+\begin{itemize}
+\item bla
+\end{itemize}  
+
+\end{frame}
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\begin{frame}[c]
+\frametitle{Types}
+
+\begin{itemize}
+\item Base types
+
+  \begin{center}
+  \begin{tabular}{l}
+    \textcolor{codegreen}{\texttt{Int}},
+    \textcolor{codegreen}{\texttt{Long}},
+    \textcolor{codegreen}{\texttt{BigInt}},
+    \textcolor{codegreen}{\texttt{Float}},
+    \textcolor{codegreen}{\texttt{Double}}\\
+    \textcolor{codegreen}{\texttt{String}},
+    \textcolor{codegreen}{\texttt{Char}}
+  \end{tabular}
+  \end{center}
+
+\item Compound types    
+
+  \begin{center}
+  \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\\
+    \textcolor{codegreen}{\texttt{List[(BigInt, String)]}} &
+                                      lists of BigInt-String\\
+                                      & pairs\\
+    \textcolor{codegreen}{\texttt{List[List[Int]]}} \\                                  
+  \end{tabular}
+  \end{center}
+
+\end{itemize}  
+
+\end{frame}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
+
 \end{document}
 
 %%% Local Variables: