slides/slides02.tex
author Christian Urban <urbanc@in.tum.de>
Thu, 15 Nov 2018 03:35:38 +0000
changeset 202 f7bcb27d1940
parent 151 c5ca7f8e21a5
child 204 9b45dd24271b
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}
151
c5ca7f8e21a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 148
diff changeset
     2
\usepackage{chessboard}
c5ca7f8e21a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 148
diff changeset
     3
\usepackage[LSBC4,T1]{fontenc}
66
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     4
\usepackage{../slides}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     5
\usepackage{../graphics}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     6
\usepackage{../langs}
151
c5ca7f8e21a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 148
diff changeset
     7
148
ead6089209ba updated
Christian Urban <urbanc@in.tum.de>
parents: 147
diff changeset
     8
% \usepackage{../data}
66
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     9
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    10
\hfuzz=220pt 
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    11
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    12
%\setmonofont[Scale=.88]{Consolas}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    13
%\newfontfamily{\consolas}{Consolas}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    14
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    15
\lstset{language=Scala,
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    16
        style=mystyle,
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    17
        numbersep=0pt,
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    18
        numbers=none,
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    19
        xleftmargin=0mm}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    20
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    21
\newcommand{\bl}[1]{\textcolor{blue}{#1}}     
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    22
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    23
% beamer stuff 
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    24
\renewcommand{\slidecaption}{PEP (Scala) 02, King's College London}
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{document}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    28
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    29
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    30
\begin{frame}[t]
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    31
\frametitle{%
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    32
  \begin{tabular}{@ {}c@ {}}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    33
  \\[5mm]
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    34
  \huge PEP Scala (2) 
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    35
  \end{tabular}}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    36
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    37
  \normalsize
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    38
  \begin{center}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    39
  \begin{tabular}{ll}
147
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    40
    Email:  & christian.urban at kcl.ac.uk\\
202
f7bcb27d1940 updated
Christian Urban <urbanc@in.tum.de>
parents: 151
diff changeset
    41
    Office: & N\liningnums{7.07} (North Wing, Bush House)\\
147
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    42
    Slides \& Code: & KEATS\medskip\\
202
f7bcb27d1940 updated
Christian Urban <urbanc@in.tum.de>
parents: 151
diff changeset
    43
    Office Hours: &  Mondays 12:00 -- 14:00\\
66
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    44
  \end{tabular}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    45
  \end{center}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    46
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    47
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    48
\end{frame}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    49
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    50
202
f7bcb27d1940 updated
Christian Urban <urbanc@in.tum.de>
parents: 151
diff changeset
    51
147
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    52
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
202
f7bcb27d1940 updated
Christian Urban <urbanc@in.tum.de>
parents: 151
diff changeset
    53
\begin{frame}[c,fragile]
f7bcb27d1940 updated
Christian Urban <urbanc@in.tum.de>
parents: 151
diff changeset
    54
\frametitle{Scala on Lab Computers}
147
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    55
202
f7bcb27d1940 updated
Christian Urban <urbanc@in.tum.de>
parents: 151
diff changeset
    56
\begin{lstlisting}[language={},numbers=none,
f7bcb27d1940 updated
Christian Urban <urbanc@in.tum.de>
parents: 151
diff changeset
    57
  basicstyle=\ttfamily\small,xleftmargin=-2mm]
f7bcb27d1940 updated
Christian Urban <urbanc@in.tum.de>
parents: 151
diff changeset
    58
$ /usr/share/scala/bin/scala
f7bcb27d1940 updated
Christian Urban <urbanc@in.tum.de>
parents: 151
diff changeset
    59
  
f7bcb27d1940 updated
Christian Urban <urbanc@in.tum.de>
parents: 151
diff changeset
    60
Welcome to Scala 2.12.6 (Java HotSpot(TM) 64-Bit
f7bcb27d1940 updated
Christian Urban <urbanc@in.tum.de>
parents: 151
diff changeset
    61
Server VM, Java 10.0.1). Type in expressions for
f7bcb27d1940 updated
Christian Urban <urbanc@in.tum.de>
parents: 151
diff changeset
    62
evaluation. Or try :help.
147
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    63
202
f7bcb27d1940 updated
Christian Urban <urbanc@in.tum.de>
parents: 151
diff changeset
    64
scala>
f7bcb27d1940 updated
Christian Urban <urbanc@in.tum.de>
parents: 151
diff changeset
    65
\end{lstlisting}%$
f7bcb27d1940 updated
Christian Urban <urbanc@in.tum.de>
parents: 151
diff changeset
    66
147
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    67
\end{frame}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    68
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    71
\begin{frame}[c]
202
f7bcb27d1940 updated
Christian Urban <urbanc@in.tum.de>
parents: 151
diff changeset
    72
\frametitle{Scala on Lab Computers}
147
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    73
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    74
Avoid at all costs, even in comments
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    75
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    76
\begin{itemize}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    77
\item \texttt{var} \only<2>{$\quad\Rightarrow\;$\texttt{Var}}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    78
\item \texttt{return} \only<2>{$\quad\Rightarrow\;$\texttt{Return}}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    79
\item \texttt{.par}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    80
\item \texttt{ListBuffer}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    81
\item \texttt{mutable}  
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    82
\end{itemize}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    83
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    84
\end{frame}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    85
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    86
202
f7bcb27d1940 updated
Christian Urban <urbanc@in.tum.de>
parents: 151
diff changeset
    87
147
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    88
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    89
\begin{frame}[t]
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    90
\frametitle{For-Comprehensions Again}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    91
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    92
\begin{center}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    93
  \begin{tikzpicture}[scale=1,
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    94
                      node/.style={
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    95
                      rectangle,rounded corners=3mm,
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    96
                      very thick,draw=black!50,
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    97
                      minimum height=18mm, minimum width=20mm,
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    98
                      top color=white,bottom color=black!20}]
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
  \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
   101
  \node (A1) at (2.3,0) {\texttt{\phantom{,}1,}};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   102
  \node (A2) at (3.2,0) {\texttt{\phantom{,}2,}};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   103
  \node (A3) at (4.1,0) {\texttt{\phantom{,}3,}};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   104
  \node (A4) at (5.0,0) {\texttt{\phantom{,}4,}};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   105
  \node (A5) at (5.9,0) {\texttt{\phantom{))}5))}};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   106
  \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
   107
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   108
  \onslide<2->{
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   109
  \node (B0) at (1.4,-3) {\texttt{List(}};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   110
  \node (B1) at (2.3,-3) {\texttt{\phantom{,}1,}};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   111
  \node (B2) at (3.6,-3) {\texttt{\phantom{,}4,}};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   112
  \node (B3) at (4.9,-3) {\texttt{\phantom{,}9,}};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   113
  \node (B4) at (6.2,-3) {\texttt{\phantom{,}16,}};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   114
  \node (B5) at (7.5,-3) {\texttt{\phantom{,}25)}};}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   115
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   116
  \onslide<2->{
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   117
  \draw [->,line width=1mm] (A1.south) -- (B1.north);
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   118
  \draw [->,line width=1mm] (A2.south) -- (B2.north);
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   119
  \draw [->,line width=1mm] (A3.south) -- (B3.north);
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   120
  \draw [->,line width=1mm] (A4.south) -- (B4.north);
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   121
  \draw [->,line width=1mm] (A5.south) -- (B5.north);}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   122
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   123
  \onslide<2->{
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   124
  \node (Q1) at (-0.45,-0.1) {};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   125
  \node (Q2) at (-0.45,-2.8) {};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   126
  \node (Q3) at (-0.45,-2.95) {\alert<2->{\texttt{n\,*\,n:}}};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   127
  \draw [->,red,line width=1mm] (Q1.south) -- (Q2.north);}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   128
 \end{tikzpicture}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   129
\end{center}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   130
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   131
\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
   132
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   133
\end{frame}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   134
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   135
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   136
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   137
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   138
\begin{frame}[t]
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   139
\frametitle{For-Comprehensions Again}
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
\begin{center}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   142
  \begin{tikzpicture}[scale=1,
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   143
                      node/.style={
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   144
                      rectangle,rounded corners=3mm,
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   145
                      very thick,draw=black!50,
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   146
                      minimum height=18mm, minimum width=20mm,
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   147
                      top color=white,bottom color=black!20}]
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   148
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   149
  \node (A0) at (0,0)
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   150
    {\texttt{\textcolor{purple}{\textbf{for}} (n <- List(1, 2, 3, 4, 5))
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   151
             \textcolor{purple}{\textbf{yield}} n\,*\,n}};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   152
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   153
  \node (A1) at (0,-1.5) {\LARGE\textbf{vs}};       
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   154
         
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   155
  \node (A2) at (0,-3)
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   156
    {\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
   157
 \end{tikzpicture}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   158
\end{center}\bigskip
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
The second version is in case the for \textbf{does not}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   162
produce any result.
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   163
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   164
\end{frame}
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
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   167
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   168
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   169
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
66
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   170
\begin{frame}[t]
148
ead6089209ba updated
Christian Urban <urbanc@in.tum.de>
parents: 147
diff changeset
   171
\frametitle{Why Scala? No null!}
66
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   172
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   173
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   174
\begin{itemize}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   175
\item \large {\bf You can avoid \textcolor{blue}{\texttt{null}}}:
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   176
\end{itemize}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   177
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   178
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   179
\begin{textblock}{6}(1,5)
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   180
  \begin{bubble}[10.5cm]\small
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   181
      ``I call it my billion-dollar mistake. It was the invention of
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   182
      the null reference in 1965. At that time, I was designing the
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   183
      first comprehensive type system for references in an object
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   184
      oriented language (ALGOL W). My goal was to ensure that all use
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   185
      of references should be absolutely safe, with checking performed
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   186
      automatically by the compiler. But I couldn't resist the
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   187
      temptation to put in a null reference, simply because it was so
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   188
      easy to implement. This has led to innumerable errors,
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   189
      vulnerabilities, and system crashes, which have probably caused
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   190
      a billion dollars of pain and damage in the last forty years.''
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   191
      \hfill Sir Tony (Hoare)
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   192
\end{bubble}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   193
\end{textblock}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   194
  
148
ead6089209ba updated
Christian Urban <urbanc@in.tum.de>
parents: 147
diff changeset
   195
\begin{textblock}{5}(12.5,1.9)
ead6089209ba updated
Christian Urban <urbanc@in.tum.de>
parents: 147
diff changeset
   196
\includegraphics[scale=0.05]{../pics/hoare.jpg}\\
66
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   197
\end{textblock}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   198
  
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   199
\end{frame}
147
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   200
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
66
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   201
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   202
148
ead6089209ba updated
Christian Urban <urbanc@in.tum.de>
parents: 147
diff changeset
   203
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ead6089209ba updated
Christian Urban <urbanc@in.tum.de>
parents: 147
diff changeset
   204
\begin{frame}[c,fragile]
ead6089209ba updated
Christian Urban <urbanc@in.tum.de>
parents: 147
diff changeset
   205
\frametitle{\begin{tabular}{c}\\[1cm]\alert{Questions?}\end{tabular}}
66
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   206
148
ead6089209ba updated
Christian Urban <urbanc@in.tum.de>
parents: 147
diff changeset
   207
\begin{center}
ead6089209ba updated
Christian Urban <urbanc@in.tum.de>
parents: 147
diff changeset
   208
\chessboard[maxfield=g7,
ead6089209ba updated
Christian Urban <urbanc@in.tum.de>
parents: 147
diff changeset
   209
            color=blue!50,
ead6089209ba updated
Christian Urban <urbanc@in.tum.de>
parents: 147
diff changeset
   210
            linewidth=0.2em,
ead6089209ba updated
Christian Urban <urbanc@in.tum.de>
parents: 147
diff changeset
   211
            shortenstart=0.5ex,
ead6089209ba updated
Christian Urban <urbanc@in.tum.de>
parents: 147
diff changeset
   212
            shortenend=0.5ex,
ead6089209ba updated
Christian Urban <urbanc@in.tum.de>
parents: 147
diff changeset
   213
            markstyle=cross,
ead6089209ba updated
Christian Urban <urbanc@in.tum.de>
parents: 147
diff changeset
   214
            markfields={a4, c4, Z3, d3, Z1, d1, a0, c0},
ead6089209ba updated
Christian Urban <urbanc@in.tum.de>
parents: 147
diff changeset
   215
            color=red!50,
ead6089209ba updated
Christian Urban <urbanc@in.tum.de>
parents: 147
diff changeset
   216
            markfields={f5, e6},
ead6089209ba updated
Christian Urban <urbanc@in.tum.de>
parents: 147
diff changeset
   217
            boardfontsize=12pt,labelfontsize=8pt,
ead6089209ba updated
Christian Urban <urbanc@in.tum.de>
parents: 147
diff changeset
   218
            setpieces={Ng7, Nb2},showmover=false]
ead6089209ba updated
Christian Urban <urbanc@in.tum.de>
parents: 147
diff changeset
   219
\end{center}
ead6089209ba updated
Christian Urban <urbanc@in.tum.de>
parents: 147
diff changeset
   220
            
ead6089209ba updated
Christian Urban <urbanc@in.tum.de>
parents: 147
diff changeset
   221
\begin{center}
ead6089209ba updated
Christian Urban <urbanc@in.tum.de>
parents: 147
diff changeset
   222
My Scala Office Hours: Thursdays 11 -- 13
ead6089209ba updated
Christian Urban <urbanc@in.tum.de>
parents: 147
diff changeset
   223
\end{center}
66
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   224
\end{frame}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   225
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   226
\end{document}
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
\end{document}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   230
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   231
%%% Local Variables:  
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   232
%%% mode: latex
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   233
%%% TeX-master: t
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   234
%%% End: 
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   235