slides/slides02.tex
author Christian Urban <urbanc@in.tum.de>
Fri, 17 Nov 2017 02:13:40 +0000
changeset 147 72f7dd1a3754
parent 66 3506b681c191
child 148 ead6089209ba
permissions -rw-r--r--
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
66
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     1
\documentclass[dvipsnames,14pt,t,xelatex]{beamer}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     2
\usepackage{../slides}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     3
\usepackage{../graphics}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     4
\usepackage{../langs}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     5
%\usepackage{../data}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     6
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     7
\hfuzz=220pt 
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     8
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     9
%\setmonofont[Scale=.88]{Consolas}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    10
%\newfontfamily{\consolas}{Consolas}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    11
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    12
\lstset{language=Scala,
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    13
        style=mystyle,
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    14
        numbersep=0pt,
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    15
        numbers=none,
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    16
        xleftmargin=0mm}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    17
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    18
\newcommand{\bl}[1]{\textcolor{blue}{#1}}     
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    19
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    20
% beamer stuff 
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    21
\renewcommand{\slidecaption}{PEP (Scala) 02, King's College London}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    22
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    23
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    24
\begin{document}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    25
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    26
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    27
\begin{frame}[t]
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    28
\frametitle{%
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    29
  \begin{tabular}{@ {}c@ {}}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    30
  \\[5mm]
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    31
  \huge PEP Scala (2) 
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    32
  \end{tabular}}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    33
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    34
  \normalsize
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    35
  \begin{center}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    36
  \begin{tabular}{ll}
147
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    37
    Email:  & christian.urban at kcl.ac.uk\\
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    38
    Office: & N7.07 (North Wing, Bush House)\\
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    39
    Slides \& Code: & KEATS\medskip\\
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    40
    Scala Office & \\
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    41
    Hours: &  Thursdays 11 -- 13\\
66
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    42
  \end{tabular}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    43
  \end{center}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    44
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    45
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    46
\end{frame}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    47
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    48
147
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    49
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    50
\begin{frame}[t,fragile]
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    51
  \frametitle{Mea Culpa}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    52
\bigskip
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    53
  
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    54
\mbox{\hspace{-4mm}}CW6, Part 3 (deadline 21 December)\bigskip\medskip  
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    55
\small
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    56
\begin{lstlisting}[language=Scala, numbers=none, xleftmargin=-4mm]
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    57
val blchip_portfolio =
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    58
 List("GOOG", "AAPL", "MSFT", "IBM", "FB",
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    59
                          "YHOO", "AMZN", "BIDU")
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    60
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    61
val rstate_portfolio =
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    62
List("PLD", "PSA", "AMT", "AIV", "AVB",
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    63
                          "BXP", "CBG", "CCI", 
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    64
     "DLR", "EQIX", "EQR", "ESS", "EXR",
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    65
                          "FRT", "GGP", "HCP") 
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    66
\end{lstlisting}\bigskip
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    67
                        
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    68
\onslide<2>{The results in the CW are calculated with YHOO and CBG deleted.}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    69
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    70
\only<2>{
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    71
\begin{textblock}{6}(8.5,6.6)
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    72
  \begin{tikzpicture}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    73
    \node (B0) at (0,0) {};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    74
    \node (B1) at (0,0.5) {};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    75
    \node (B2) at (1.2,0) {};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    76
    \node (B3) at (1.2,0.5) {};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    77
    \draw [red,line width=1mm] (B0) -- (B3);
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    78
    \draw [red,line width=1mm] (B1) -- (B2);
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    79
  \end{tikzpicture}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    80
\end{textblock}}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    81
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    82
\only<2>{
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    83
\begin{textblock}{6}(10.5,9.9)
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    84
  \begin{tikzpicture}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    85
    \node (B0) at (0,0) {};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    86
    \node (B1) at (0,0.5) {};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    87
    \node (B2) at (1.2,0) {};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    88
    \node (B3) at (1.2,0.5) {};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    89
    \draw [red,line width=1mm] (B0) -- (B3);
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    90
    \draw [red,line width=1mm] (B1) -- (B2);
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    91
  \end{tikzpicture}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    92
\end{textblock}}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    93
\end{frame}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    94
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    95
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    96
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    97
\begin{frame}[c]
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    98
\frametitle{Mea Culpa 2}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    99
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   100
Avoid at all costs, even in comments
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   101
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   102
\begin{itemize}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   103
\item \texttt{var} \only<2>{$\quad\Rightarrow\;$\texttt{Var}}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   104
\item \texttt{return} \only<2>{$\quad\Rightarrow\;$\texttt{Return}}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   105
\item \texttt{.par}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   106
\item \texttt{ListBuffer}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   107
\item \texttt{mutable}  
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   108
\end{itemize}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   109
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   110
\end{frame}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   111
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   112
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   113
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   114
\begin{frame}[t]
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   115
\frametitle{For-Comprehensions Again}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   116
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   117
\begin{center}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   118
  \begin{tikzpicture}[scale=1,
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   119
                      node/.style={
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   120
                      rectangle,rounded corners=3mm,
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   121
                      very thick,draw=black!50,
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   122
                      minimum height=18mm, minimum width=20mm,
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   123
                      top color=white,bottom color=black!20}]
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   124
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   125
  \node (A0) at (0.1,0) {\texttt{\textcolor{purple}{\textbf{for}} (\alert<2->{n} <- List(}};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   126
  \node (A1) at (2.3,0) {\texttt{\phantom{,}1,}};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   127
  \node (A2) at (3.2,0) {\texttt{\phantom{,}2,}};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   128
  \node (A3) at (4.1,0) {\texttt{\phantom{,}3,}};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   129
  \node (A4) at (5.0,0) {\texttt{\phantom{,}4,}};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   130
  \node (A5) at (5.9,0) {\texttt{\phantom{))}5))}};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   131
  \node (A6) at (8,0) {\texttt{\textcolor{purple}{\textbf{yield}} \alert<2->{n\,*\,n}}};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   132
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   133
  \onslide<2->{
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   134
  \node (B0) at (1.4,-3) {\texttt{List(}};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   135
  \node (B1) at (2.3,-3) {\texttt{\phantom{,}1,}};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   136
  \node (B2) at (3.6,-3) {\texttt{\phantom{,}4,}};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   137
  \node (B3) at (4.9,-3) {\texttt{\phantom{,}9,}};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   138
  \node (B4) at (6.2,-3) {\texttt{\phantom{,}16,}};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   139
  \node (B5) at (7.5,-3) {\texttt{\phantom{,}25)}};}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   140
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   141
  \onslide<2->{
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   142
  \draw [->,line width=1mm] (A1.south) -- (B1.north);
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   143
  \draw [->,line width=1mm] (A2.south) -- (B2.north);
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   144
  \draw [->,line width=1mm] (A3.south) -- (B3.north);
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   145
  \draw [->,line width=1mm] (A4.south) -- (B4.north);
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   146
  \draw [->,line width=1mm] (A5.south) -- (B5.north);}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   147
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   148
  \onslide<2->{
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   149
  \node (Q1) at (-0.45,-0.1) {};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   150
  \node (Q2) at (-0.45,-2.8) {};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   151
  \node (Q3) at (-0.45,-2.95) {\alert<2->{\texttt{n\,*\,n:}}};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   152
  \draw [->,red,line width=1mm] (Q1.south) -- (Q2.north);}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   153
 \end{tikzpicture}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   154
\end{center}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   155
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   156
\onslide<3>{This is for when the for-comprehension\\ \textbf{yields / produces} a result.}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   157
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   158
\end{frame}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   159
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   160
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   161
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   162
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   163
\begin{frame}[t]
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   164
\frametitle{For-Comprehensions Again}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   165
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   166
\begin{center}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   167
  \begin{tikzpicture}[scale=1,
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   168
                      node/.style={
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   169
                      rectangle,rounded corners=3mm,
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   170
                      very thick,draw=black!50,
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   171
                      minimum height=18mm, minimum width=20mm,
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   172
                      top color=white,bottom color=black!20}]
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   173
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   174
  \node (A0) at (0,0)
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   175
    {\texttt{\textcolor{purple}{\textbf{for}} (n <- List(1, 2, 3, 4, 5))
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   176
             \textcolor{purple}{\textbf{yield}} n\,*\,n}};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   177
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   178
  \node (A1) at (0,-1.5) {\LARGE\textbf{vs}};       
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   179
         
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   180
  \node (A2) at (0,-3)
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   181
    {\texttt{\textcolor{purple}{\textbf{for}} (n <- List(1, 2, 3, 4, 5)) println(n)}};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   182
 \end{tikzpicture}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   183
\end{center}\bigskip
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   184
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   185
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   186
The second version is in case the for \textbf{does not}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   187
produce any result.
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   188
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   189
\end{frame}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   190
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   191
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   192
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   193
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   194
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
66
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   195
\begin{frame}[t]
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   196
\frametitle{\begin{tabular}{c}Why Scala?\end{tabular}}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   197
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   198
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   199
\begin{itemize}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   200
\item \large {\bf You can avoid \textcolor{blue}{\texttt{null}}}:
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   201
\end{itemize}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   202
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   203
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   204
\begin{textblock}{6}(1,5)
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   205
  \begin{bubble}[10.5cm]\small
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   206
      ``I call it my billion-dollar mistake. It was the invention of
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   207
      the null reference in 1965. At that time, I was designing the
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   208
      first comprehensive type system for references in an object
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   209
      oriented language (ALGOL W). My goal was to ensure that all use
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   210
      of references should be absolutely safe, with checking performed
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   211
      automatically by the compiler. But I couldn't resist the
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   212
      temptation to put in a null reference, simply because it was so
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   213
      easy to implement. This has led to innumerable errors,
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   214
      vulnerabilities, and system crashes, which have probably caused
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   215
      a billion dollars of pain and damage in the last forty years.''
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   216
      \hfill Sir Tony (Hoare)
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   217
\end{bubble}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   218
\end{textblock}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   219
  
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   220
\begin{textblock}{5}(11.8,1)
147
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   221
%%\includegraphics[scale=0.20]{hoare.jpg}\\
66
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   222
\end{textblock}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   223
  
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   224
\end{frame}
147
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   225
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
66
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   226
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   227
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   228
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   229
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   230
\begin{frame}[c]
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   231
\frametitle{Types}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   232
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   233
\begin{itemize}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   234
\item Base types\smallskip
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   235
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   236
  \begin{tabular}{@{}l@{}}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   237
    \textcolor{codegreen}{\texttt{Int}},
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   238
    \textcolor{codegreen}{\texttt{Long}},
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   239
    \textcolor{codegreen}{\texttt{BigInt}},
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   240
    \textcolor{codegreen}{\texttt{Float}},
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   241
    \textcolor{codegreen}{\texttt{Double}}\\
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   242
    \textcolor{codegreen}{\texttt{String}},
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   243
    \textcolor{codegreen}{\texttt{Char}}\\
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   244
    \textcolor{codegreen}{\texttt{Boolean}}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   245
  \end{tabular}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   246
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   247
\item Compound types \smallskip   
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   248
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   249
  \begin{tabular}{@{}ll@{}}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   250
    \textcolor{codegreen}{\texttt{List[Int]}}     & lists of Int's \\
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   251
    \textcolor{codegreen}{\texttt{Set[Double]}}   & sets of Double's \\
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   252
    \textcolor{codegreen}{\texttt{(Int, String)}} & Int-String pair\\
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   253
    \textcolor{codegreen}{\texttt{List[(BigInt, String)]}} &
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   254
                                      lists of BigInt-String\\
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   255
                                      & pairs\\
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   256
    \textcolor{codegreen}{\texttt{List[List[Int]]}} & list of lists of Int's\\                                  
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   257
  \end{tabular}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   258
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   259
\end{itemize}  
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   260
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   261
\end{frame}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   262
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   263
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   264
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   265
\begin{frame}[c]
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   266
\frametitle{\begin{tabular}{c}\\[3cm]\alert{Questions?}\end{tabular}}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   267
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   268
\mbox{}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   269
\end{frame}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   270
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   271
\end{document}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   272
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   273
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   274
\end{document}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   275
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   276
%%% Local Variables:  
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   277
%%% mode: latex
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   278
%%% TeX-master: t
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   279
%%% End: 
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   280