| 327 |      1 | % !TEX program = xelatex
 | 
| 383 |      2 | \documentclass[dvipsnames,14pt,t,xelatex,aspectratio=169,xcolor={table}]{beamer}
 | 
| 239 |      3 | \usepackage{../slides}
 | 
|  |      4 | \usepackage{../graphics}
 | 
|  |      5 | \usepackage{../langs}
 | 
|  |      6 | %%\usepackage{../data}
 | 
| 327 |      7 | %%\usepackage[export]{adjustbox}
 | 
|  |      8 | \usetikzlibrary{shapes,arrows,shadows}
 | 
|  |      9 | 
 | 
| 239 |     10 | 
 | 
| 415 |     11 | % Swift, example (a*)*b  
 | 
|  |     12 | \begin{filecontents}{re-swift.data}
 | 
|  |     13 | 5   0.001
 | 
|  |     14 | 10  0.001
 | 
|  |     15 | 15  0.009
 | 
|  |     16 | 20  0.178
 | 
|  |     17 | 23  1.399
 | 
|  |     18 | 24  2.893
 | 
|  |     19 | 25  5.671
 | 
|  |     20 | 26  11.357
 | 
|  |     21 | 27  22.430
 | 
|  |     22 | \end{filecontents}
 | 
|  |     23 | 
 | 
|  |     24 | % Dart, example (a*)*b  
 | 
|  |     25 | \begin{filecontents}{re-dart.data}
 | 
|  |     26 | 20 0.042
 | 
|  |     27 | 21 0.084
 | 
|  |     28 | 22 0.190
 | 
|  |     29 | 23 0.340
 | 
|  |     30 | 24 0.678
 | 
|  |     31 | 25 1.369
 | 
|  |     32 | 26 2.700
 | 
|  |     33 | 27 5.462
 | 
|  |     34 | 28 10.908
 | 
|  |     35 | 29 21.725
 | 
|  |     36 | 30 43.492
 | 
|  |     37 | \end{filecontents}
 | 
|  |     38 | 
 | 
|  |     39 | 
 | 
|  |     40 | \begin{filecontents}{re3a.data}
 | 
|  |     41 | 1 0.00003
 | 
|  |     42 | 500001 0.22527
 | 
|  |     43 | 1000001 0.62752
 | 
|  |     44 | 1500001 0.88485
 | 
|  |     45 | 2000001 1.39815
 | 
|  |     46 | 2500001 1.68619
 | 
|  |     47 | 3000001 1.94957
 | 
|  |     48 | 3500001 2.15878
 | 
|  |     49 | 4000001 2.59918
 | 
|  |     50 | 4500001 5.90679
 | 
|  |     51 | 5000001 13.11295
 | 
|  |     52 | 5500001 19.15376
 | 
|  |     53 | 6000001 40.16373
 | 
|  |     54 | \end{filecontents}
 | 
|  |     55 | \begin{filecontents}{re-python2.data}
 | 
|  |     56 | 1 0.033
 | 
|  |     57 | 5 0.036
 | 
|  |     58 | 10 0.034
 | 
|  |     59 | 15 0.036
 | 
|  |     60 | 18 0.059
 | 
|  |     61 | 19 0.084
 | 
|  |     62 | 20 0.141
 | 
|  |     63 | 21 0.248
 | 
|  |     64 | 22 0.485
 | 
|  |     65 | 23 0.878
 | 
|  |     66 | 24 1.71
 | 
|  |     67 | 25 3.40
 | 
|  |     68 | 26 7.08
 | 
|  |     69 | 27 14.12
 | 
|  |     70 | 28 26.69
 | 
|  |     71 | \end{filecontents}
 | 
|  |     72 | 
 | 
|  |     73 | \begin{filecontents}{re-js.data}
 | 
|  |     74 | 5   0.061
 | 
|  |     75 | 10  0.061
 | 
|  |     76 | 15  0.061
 | 
|  |     77 | 20  0.070
 | 
|  |     78 | 23  0.131
 | 
|  |     79 | 25  0.308
 | 
|  |     80 | 26  0.564
 | 
|  |     81 | 28  1.994
 | 
|  |     82 | 30  7.648
 | 
|  |     83 | 31  15.881 
 | 
|  |     84 | 32  32.190
 | 
|  |     85 | \end{filecontents}
 | 
|  |     86 | 
 | 
|  |     87 | \begin{filecontents}{re-java.data}
 | 
|  |     88 | 5  0.00298
 | 
|  |     89 | 10  0.00418
 | 
|  |     90 | 15  0.00996
 | 
|  |     91 | 16  0.01710
 | 
|  |     92 | 17  0.03492
 | 
|  |     93 | 18  0.03303
 | 
|  |     94 | 19  0.05084
 | 
|  |     95 | 20  0.10177
 | 
|  |     96 | 21  0.19960
 | 
|  |     97 | 22  0.41159
 | 
|  |     98 | 23  0.82234
 | 
|  |     99 | 24  1.70251
 | 
|  |    100 | 25  3.36112
 | 
|  |    101 | 26  6.63998
 | 
|  |    102 | 27  13.35120
 | 
|  |    103 | 28  29.81185
 | 
|  |    104 | \end{filecontents}
 | 
|  |    105 | 
 | 
|  |    106 | \begin{filecontents}{re-java9.data}
 | 
|  |    107 | 1000  0.01410
 | 
|  |    108 | 2000  0.04882
 | 
|  |    109 | 3000  0.10609
 | 
|  |    110 | 4000  0.17456
 | 
|  |    111 | 5000  0.27530
 | 
|  |    112 | 6000  0.41116
 | 
|  |    113 | 7000  0.53741
 | 
|  |    114 | 8000  0.70261
 | 
|  |    115 | 9000  0.93981
 | 
|  |    116 | 10000 0.97419
 | 
|  |    117 | 11000 1.28697
 | 
|  |    118 | 12000 1.51387
 | 
|  |    119 | 14000 2.07079
 | 
|  |    120 | 16000 2.69846
 | 
|  |    121 | 20000 4.41823
 | 
|  |    122 | 24000 6.46077
 | 
|  |    123 | 26000 7.64373
 | 
|  |    124 | 30000 9.99446
 | 
|  |    125 | 34000 12.966885
 | 
|  |    126 | 38000 16.281621
 | 
|  |    127 | 42000 19.180228
 | 
|  |    128 | 46000 21.984721
 | 
|  |    129 | 50000 26.950203
 | 
|  |    130 | 60000 43.0327746
 | 
|  |    131 | \end{filecontents}
 | 
|  |    132 | 
 | 
|  |    133 | 
 | 
| 239 |    134 | \hfuzz=220pt 
 | 
|  |    135 | 
 | 
|  |    136 | %\setmonofont[Scale=.88]{Consolas}
 | 
|  |    137 | %\newfontfamily{\consolas}{Consolas}
 | 
|  |    138 | 
 | 
|  |    139 | \lstset{language=Scala,
 | 
|  |    140 |         style=mystyle,
 | 
|  |    141 |         numbersep=0pt,
 | 
|  |    142 |         numbers=none,
 | 
|  |    143 |         xleftmargin=0mm}
 | 
|  |    144 | 
 | 
|  |    145 | \newcommand{\bl}[1]{\textcolor{blue}{#1}}     
 | 
|  |    146 | 
 | 
|  |    147 | % beamer stuff 
 | 
|  |    148 | \renewcommand{\slidecaption}{PEP (Scala) 05, King's College London}
 | 
|  |    149 | 
 | 
|  |    150 | \begin{document}
 | 
|  |    151 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    152 | \begin{frame}[t]
 | 
|  |    153 | \frametitle{%
 | 
|  |    154 |   \begin{tabular}{@ {}c@ {}}
 | 
|  |    155 |   \\[5mm]
 | 
|  |    156 |   \huge PEP Scala (5) 
 | 
|  |    157 |   \end{tabular}}
 | 
|  |    158 | 
 | 
|  |    159 |   \normalsize
 | 
|  |    160 |   \begin{center}
 | 
|  |    161 |   \begin{tabular}{ll}
 | 
|  |    162 |     Email:  & christian.urban at kcl.ac.uk\\
 | 
| 383 |    163 |     %Office: & N\liningnums{7.07} (North Wing, Bush House)\bigskip\\
 | 
| 415 |    164 |     Slides \& Code: & KEATS\bigskip\\
 | 
| 383 |    165 |     %                & \onslide<2>{\alert{PDF: A Crash-Course in Scala}}\bigskip\\
 | 
|  |    166 |     %Office Hours: &  Thursdays 12:00 -- 14:00\\
 | 
| 415 |    167 |     %Additionally: & (for Scala) Tuesdays 10:45 -- 11:45\\
 | 
|  |    168 |     \multicolumn{2}{c}{\Large\textbf{https://pollev.com/cfltutoratki576}}\\[2cm]
 | 
| 239 |    169 |   \end{tabular}
 | 
|  |    170 |   \end{center}
 | 
|  |    171 | 
 | 
|  |    172 | \end{frame}
 | 
|  |    173 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
 | 
|  |    174 | 
 | 
| 415 |    175 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    176 | \begin{frame}<1>[c]
 | 
|  |    177 |   \frametitle{Main 3: Regexes}
 | 
|  |    178 |   
 | 
|  |    179 | \begin{center}
 | 
|  |    180 |   \mbox{Graphs: regex \alert{\texttt{(a*)*b}} and strings $\underbrace{\;\texttt{a}\ldots \texttt{a}\;}_{n}$}\bigskip
 | 
|  |    181 | 
 | 
|  |    182 | 
 | 
|  |    183 |   \small  
 | 
|  |    184 | \begin{tabular}[t]{@{\hspace{-8mm}}c@{\hspace{-0mm}}c@{}}
 | 
|  |    185 | \only<1>{\raisebox{6mm}{\begin{tikzpicture}
 | 
|  |    186 | \begin{axis}[
 | 
|  |    187 |     xlabel={$n$},
 | 
|  |    188 |     x label style={at={(1.05,0.0)}},
 | 
|  |    189 |     ylabel={time in secs},
 | 
|  |    190 |     enlargelimits=false,
 | 
|  |    191 |     xtick={0,5,...,30},
 | 
|  |    192 |     xmax=33,
 | 
|  |    193 |     ymax=35,
 | 
|  |    194 |     ytick={0,5,...,30},
 | 
|  |    195 |     scaled ticks=false,
 | 
|  |    196 |     axis lines=left,
 | 
|  |    197 |     width=5.5cm,
 | 
|  |    198 |     height=5cm,
 | 
|  |    199 |     legend entries={Java 8,Python,JavaScript,Swift,Dart},
 | 
|  |    200 |     %legend entries={\small{}Python,  \small{}Java 8,  \small{}JavaScript},  
 | 
|  |    201 |     legend pos=north west,
 | 
|  |    202 |     legend cell align=left]
 | 
|  |    203 | \addplot[blue,mark=*, mark options={fill=white}] table {re-python2.data};  
 | 
|  |    204 | \addplot[cyan,mark=*, mark options={fill=white}] table {re-java.data};
 | 
|  |    205 | \addplot[red,mark=*, mark options={fill=white}] table {re-js.data};
 | 
|  |    206 | \addplot[magenta,mark=*, mark options={fill=white}] table {re-swift.data};
 | 
|  |    207 | \addplot[brown,mark=*, mark options={fill=white}] table {re-dart.data};
 | 
|  |    208 | \end{axis}
 | 
|  |    209 | \end{tikzpicture}}}%
 | 
|  |    210 | \only<2>{\raisebox{0mm}{\begin{tikzpicture}
 | 
|  |    211 | \begin{axis}[
 | 
|  |    212 |     xlabel={$n$},
 | 
|  |    213 |     x label style={at={(1.05,0.0)}},
 | 
|  |    214 |     ylabel={time in secs},
 | 
|  |    215 |     %y label style={at={(0.06,0.5)}},
 | 
|  |    216 |     enlargelimits=false,
 | 
|  |    217 |     %xtick={0,30000,...,60000},
 | 
|  |    218 |     xmax=65000,
 | 
|  |    219 |     ymax=35,
 | 
|  |    220 |     ytick={0,5,...,30},
 | 
|  |    221 |     scaled ticks=true,
 | 
|  |    222 |     axis lines=left,
 | 
|  |    223 |     width=5.5cm,
 | 
|  |    224 |     height=5cm, 
 | 
|  |    225 |     legend entries={\small{}Java 9},  
 | 
|  |    226 |     legend pos=north west]
 | 
|  |    227 | \addplot[cyan,mark=*, mark options={fill=white}] table {re-java9.data};
 | 
|  |    228 | \end{axis}
 | 
|  |    229 | \end{tikzpicture}}}
 | 
|  |    230 |   &
 | 
|  |    231 | \onslide<1-2>{\begin{tikzpicture}
 | 
|  |    232 |   \begin{axis}[
 | 
|  |    233 |     xlabel={$n$},
 | 
|  |    234 |     x label style={at={(1.05,0.0)}},
 | 
|  |    235 |     ylabel={time in secs},
 | 
|  |    236 |     enlargelimits=false,
 | 
|  |    237 |     ymax=35,
 | 
|  |    238 |     ytick={0,5,...,30},
 | 
|  |    239 |     axis lines=left,
 | 
|  |    240 |     legend entries={You in M3}, 
 | 
|  |    241 |     %%scaled ticks=false,
 | 
|  |    242 |     width=5.5cm, 
 | 
|  |    243 |     height=5cm]
 | 
|  |    244 | %%\addplot[green,mark=square*,mark options={fill=white}] table {re2a.data};    
 | 
|  |    245 | \addplot[magenta,mark=square*,mark options={fill=white}] table {re3a.data};
 | 
|  |    246 | \end{axis}
 | 
|  |    247 | \end{tikzpicture}}
 | 
|  |    248 | \end{tabular}
 | 
|  |    249 | \end{center}
 | 
|  |    250 | 
 | 
|  |    251 | \hfill\small\url{https://vimeo.com/112065252}
 | 
|  |    252 | \end{frame}
 | 
|  |    253 | 
 | 
|  |    254 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    255 | 
 | 
|  |    256 | 
 | 
|  |    257 | 
 | 
| 240 |    258 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
 | 
|  |    259 | 
 | 
| 383 |    260 | %\begin{frame}[c]
 | 
|  |    261 | %\frametitle{Marks for Preliminary 8}
 | 
|  |    262 | %
 | 
|  |    263 | %Raw marks (265 submissions):\bigskip
 | 
|  |    264 | %
 | 
|  |    265 | %\begin{itemize}
 | 
|  |    266 | %\item 4\%: \hspace{4mm}211
 | 
|  |    267 | %\item 3\%: \hspace{4mm}11
 | 
|  |    268 | %\item 2\%: \hspace{4mm}14
 | 
|  |    269 | %\item 1\%: \hspace{4mm}8
 | 
|  |    270 | %\item 0\%: \hspace{4mm}21
 | 
|  |    271 | %\end{itemize}\bigskip\bigskip  
 | 
|  |    272 | %
 | 
|  |    273 | %\footnotesize
 | 
|  |    274 | %(plagiarism/collusion interviews ongoing again!)
 | 
|  |    275 | %
 | 
|  |    276 | %\end{frame}
 | 
| 327 |    277 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    278 | 
 | 
|  |    279 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
 | 
|  |    280 | 
 | 
|  |    281 | \begin{frame}[c]
 | 
|  |    282 | \frametitle{Plan for Today}
 | 
| 240 |    283 | 
 | 
|  |    284 | \begin{itemize}
 | 
| 327 |    285 | \item Being Lazy
 | 
|  |    286 | \item Polymorphic Types
 | 
|  |    287 | \item Immutable OOP
 | 
|  |    288 | \item Making Fun about Scala
 | 
|  |    289 | \end{itemize}
 | 
|  |    290 | 
 | 
| 240 |    291 | \end{frame}
 | 
| 327 |    292 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    293 | 
 | 
|  |    294 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
 | 
|  |    295 | \begin{frame}[c,fragile]
 | 
|  |    296 | \frametitle{How To calcululate 100 Mio Collatz Series?} 
 | 
|  |    297 | 
 | 
|  |    298 | \begin{lstlisting}[language=Scala, numbers=none, xleftmargin=1mm]
 | 
|  |    299 | (1L to 100_000_000).map(collatz).max
 | 
|  |    300 | \end{lstlisting}
 | 
|  |    301 | 
 | 
|  |    302 | \end{frame}
 | 
|  |    303 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    304 | 
 | 
|  |    305 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
 | 
|  |    306 | \begin{frame}[c,fragile]
 | 
|  |    307 | \frametitle{Polyorphic Types} 
 | 
|  |    308 | 
 | 
|  |    309 | To be avoided:\bigskip\bigskip
 | 
|  |    310 | \small
 | 
|  |    311 | 
 | 
|  |    312 | \begin{lstlisting}[language=Scala, numbers=none, xleftmargin=-6mm]
 | 
|  |    313 | def length_string_list(lst: List[String]): Int = 
 | 
|  |    314 |  lst match {
 | 
|  |    315 |    case Nil => 0
 | 
|  |    316 |    case x::xs => 1 + length_string_list(xs)
 | 
|  |    317 |  }
 | 
| 240 |    318 | 
 | 
|  |    319 | 
 | 
| 327 |    320 | def length_int_list(lst: List[Int]): Int = 
 | 
|  |    321 |  lst match {
 | 
|  |    322 |    case Nil => 0
 | 
|  |    323 |    case x::xs => 1 + length_int_list(xs)
 | 
|  |    324 |  }
 | 
|  |    325 | \end{lstlisting}
 | 
|  |    326 | 
 | 
|  |    327 | \end{frame}
 | 
|  |    328 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    329 | 
 | 
|  |    330 | 
 | 
|  |    331 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
 | 
|  |    332 | \begin{frame}[c,fragile]
 | 
|  |    333 | \frametitle{Polyorphic Types} 
 | 
|  |    334 | 
 | 
|  |    335 | \small
 | 
|  |    336 | 
 | 
|  |    337 | \begin{lstlisting}[language=Scala, numbers=none, xleftmargin=-6mm]
 | 
|  |    338 | def length[A](lst: List[A]): Int = lst match {
 | 
|  |    339 |   case Nil => 0
 | 
|  |    340 |   case x::xs => 1 + length(xs)
 | 
|  |    341 | }
 | 
|  |    342 | 
 | 
|  |    343 | length(List("1", "2", "3", "4"))
 | 
|  |    344 | length(List(1, 2, 3, 4))
 | 
|  |    345 | 
 | 
|  |    346 | 
 | 
|  |    347 | def map[A, B](lst: List[A], f: A => B): List[B] = 
 | 
|  |    348 |  lst match {
 | 
|  |    349 |    case Nil => Nil
 | 
|  |    350 |    case x::xs => f(x)::map(xs, f) 
 | 
|  |    351 |  }
 | 
|  |    352 | \end{lstlisting}
 | 
|  |    353 | \end{frame}
 | 
| 240 |    354 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    355 | 
 | 
|  |    356 | 
 | 
|  |    357 | 
 | 
| 239 |    358 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
| 327 |    359 | \begin{frame}[c]
 | 
|  |    360 | \frametitle{DFAs}  
 | 
|  |    361 | 
 | 
|  |    362 | \begin{center}
 | 
|  |    363 | \begin{tikzpicture}[>=stealth',very thick,auto,
 | 
|  |    364 |   every state/.style={minimum size=0pt,inner sep=2pt,
 | 
|  |    365 |     draw=blue!50,very thick,fill=blue!20},]
 | 
| 239 |    366 |   
 | 
| 327 |    367 | \only<1,3->{\node[state,initial] (Q_0)  {$\mbox{Q}_0$};}
 | 
|  |    368 | \only<2>{\node[state,initial,fill=red] (Q_0)  {$\mbox{Q}_0$};}  
 | 
|  |    369 | \only<1,2,4->{\node[state] (Q_1) [right=of Q_0] {$\mbox{Q}_1$};}
 | 
|  |    370 | \only<3>{\node[state,fill=red] (Q_1) [right=of Q_0] {$\mbox{Q}_1$};}
 | 
|  |    371 | \only<-3,5->{\node[state] (Q_2) [below right=of Q_0] {$\mbox{Q}_2$};}
 | 
|  |    372 | \only<4>{\node[state,fill=red] (Q_2) [below right=of Q_0] {$\mbox{Q}_2$};}
 | 
|  |    373 | \only<-4,6->{\node[state] (Q_3) [right=of Q_2] {$\mbox{Q}_3$};}
 | 
|  |    374 | \only<5>{\node[state,fill=red] (Q_3) [right=of Q_2] {$\mbox{Q}_3$};}
 | 
|  |    375 | \only<-5>{\node[state, accepting] (Q_4) [right=of Q_1] {$\mbox{Q}_4$};}
 | 
|  |    376 | \only<6->{\node[state, accepting,fill=red] (Q_4) [right=of Q_1] {$\mbox{Q}_4$};}
 | 
|  |    377 | 
 | 
|  |    378 | \path[->] (Q_0) edge node [above]  {\alert{$a$}} (Q_1);
 | 
|  |    379 | \path[->] (Q_1) edge node [above]  {\alert{$a$}} (Q_4);
 | 
|  |    380 | \path[->] (Q_4) edge [loop right] node  {\alert{$a, b$}} ();
 | 
|  |    381 | \path[->] (Q_3) edge node [right]  {\alert{$a$}} (Q_4);
 | 
|  |    382 | \path[->] (Q_2) edge node [above]  {\alert{$a$}} (Q_3);
 | 
|  |    383 | \path[->] (Q_1) edge node [right]  {\alert{$b$}} (Q_2);
 | 
|  |    384 | \path[->] (Q_0) edge node [above]  {\alert{$b$}} (Q_2);
 | 
|  |    385 | \path[->] (Q_2) edge [loop left] node  {\alert{$b$}} ();
 | 
|  |    386 | \path[->] (Q_3) edge [bend left=95, looseness=1.3] node [below]  {\alert{$b$}} (Q_0);
 | 
|  |    387 | \end{tikzpicture}
 | 
|  |    388 | \end{center}
 | 
| 239 |    389 | 
 | 
| 383 |    390 | \begin{textblock}{10}(4,12)
 | 
|  |    391 | \LARGE{}\phantom{b}
 | 
|  |    392 | \only<-2>{\boldmath\textcolor{gray}{$a$}}\only<3->{\boldmath\alert{$a$}}%
 | 
|  |    393 | \only<-3>{\boldmath\textcolor{gray}{$b$}}\only<4->{\boldmath\alert{$b$}}%
 | 
|  |    394 | \only<-4>{\boldmath\textcolor{gray}{$a$}}\only<5->{\boldmath\alert{$a$}}%
 | 
|  |    395 | \only<-5>{\boldmath\textcolor{gray}{$a$}}\only<6->{\boldmath\alert{$a$}}%
 | 
|  |    396 | \only<-6>{\boldmath\textcolor{gray}{$a$}}\only<7->{\boldmath\alert{$a\quad\Rightarrow \textbf{yes}$}}% 
 | 
| 327 |    397 | \end{textblock}
 | 
|  |    398 |   
 | 
|  |    399 | \end{frame}
 | 
|  |    400 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    401 | 
 | 
|  |    402 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    403 | \begin{frame}[t]
 | 
|  |    404 | \frametitle{DFAs}
 | 
| 239 |    405 | 
 | 
| 327 |    406 | A \alert{\bf deterministic finite automaton} (DFA) consists of
 | 
|  |    407 | 5 things:
 | 
| 239 |    408 | 
 | 
| 327 |    409 | \begin{itemize}
 | 
|  |    410 | \item an alphabet \bl{$\varSigma$}  
 | 
|  |    411 | \item a set of states \bl{$\mbox{Qs}$}
 | 
|  |    412 | \item one of these states is the start state \bl{$\mbox{Q}_0$}
 | 
|  |    413 | \item some states are accepting states \bl{$F$}, and
 | 
|  |    414 | \item there is transition function \bl{$\delta$}\bigskip 
 | 
|  |    415 | 
 | 
|  |    416 | \small
 | 
|  |    417 | which takes a state  and a character as arguments and produces a 
 | 
|  |    418 | new state; this function might not be everywhere defined 
 | 
|  |    419 | \end{itemize}
 | 
|  |    420 | 
 | 
|  |    421 | \begin{center}
 | 
|  |    422 | \bl{$A(\varSigma, \mbox{Qs}, \mbox{Q}_0, F, \delta)$}
 | 
|  |    423 | \end{center}
 | 
| 239 |    424 | 
 | 
|  |    425 | \end{frame}
 | 
| 327 |    426 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    427 | 
 | 
|  |    428 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    429 | \begin{frame}[c]
 | 
|  |    430 | \frametitle{NFAs}  
 | 
| 239 |    431 | 
 | 
| 327 |    432 | \begin{center}
 | 
|  |    433 | \begin{tikzpicture}[>=stealth',very thick, auto,
 | 
|  |    434 |     every state/.style={minimum size=0pt,inner sep=3pt,
 | 
|  |    435 |       draw=blue!50,very thick,fill=blue!20},scale=2]
 | 
|  |    436 | \node[state,initial]  (Q_0)  {$\mbox{Q}_0$};
 | 
|  |    437 | \node[state] (Q_1) [right=of Q_0] {$\mbox{Q}_1$};
 | 
|  |    438 | \node[state, accepting] (Q_2) [right=of Q_1] {$\mbox{Q}_2$};
 | 
|  |    439 | \path[->] (Q_0) edge [loop above] node  {\alert{$b$}} ();
 | 
|  |    440 | \path[<-] (Q_0) edge node [below]  {\alert{$b$}} (Q_1);
 | 
|  |    441 | \path[->] (Q_0) edge [bend left] node [above]  {\alert{$a$}} (Q_1);
 | 
|  |    442 | \path[->] (Q_0) edge [bend right=45,looseness=1.3] node [below]  {\alert{$a$}} (Q_2);
 | 
|  |    443 | \path[->] (Q_1) edge [loop above] node  {\alert{$a,b$}} ();
 | 
|  |    444 | \path[->] (Q_1) edge node  [above] {\alert{$a$}} (Q_2);
 | 
|  |    445 | \end{tikzpicture}
 | 
|  |    446 | \end{center}
 | 
| 239 |    447 | 
 | 
| 327 |    448 | \end{frame}
 | 
|  |    449 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
 | 
| 239 |    450 | 
 | 
|  |    451 | 
 | 
|  |    452 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
 | 
|  |    453 | 
 | 
|  |    454 | \begin{frame}[c]
 | 
|  |    455 | \frametitle{Where to go on from here?}
 | 
|  |    456 | 
 | 
|  |    457 | \begin{itemize}
 | 
| 415 |    458 | \item Martin Odersky (EPFL) developed Scala 3.0\medskip
 | 
| 239 |    459 | 
 | 
|  |    460 | \item Elm (\url{http://elm-lang.org})\ldots web applications with style\medskip   
 | 
|  |    461 | 
 | 
|  |    462 | \item Haskell, Ocaml, Standard ML, Scheme, \ldots 
 | 
|  |    463 | \end{itemize}  
 | 
|  |    464 | \end{frame}
 | 
|  |    465 | 
 | 
|  |    466 | 
 | 
|  |    467 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    468 | 
 | 
|  |    469 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    470 | \begin{frame}[c,fragile]
 | 
|  |    471 | \frametitle{\alert{Questions?}}
 | 
|  |    472 | 
 | 
|  |    473 | {\tiny
 | 
|  |    474 | \begin{verbatim}
 | 
|  |    475 |                                *
 | 
|  |    476 |                               * *
 | 
|  |    477 |                              *   *
 | 
|  |    478 |                             * * * *
 | 
|  |    479 |                            *       *
 | 
|  |    480 |                           * *     * *
 | 
|  |    481 |                          *   *   *   *
 | 
|  |    482 |                         * * * * * * * *
 | 
|  |    483 |                        *               *
 | 
|  |    484 |                       * *             * *
 | 
|  |    485 |                      *   *           *   *
 | 
|  |    486 |                     * * * *         * * * *
 | 
|  |    487 |                    *       *       *       *
 | 
|  |    488 |                   * *     * *     * *     * *
 | 
|  |    489 |                  *   *   *   *   *   *   *   *
 | 
|  |    490 |                 * * * * * * * * * * * * * * * *
 | 
|  |    491 |                *                               *
 | 
|  |    492 |               * *                             * *
 | 
|  |    493 |              *   *                           *   *
 | 
|  |    494 |             * * * *                         * * * *
 | 
|  |    495 |            *       *                       *       *
 | 
|  |    496 |           * *     * *                     * *     * *
 | 
|  |    497 |          *   *   *   *                   *   *   *   *
 | 
|  |    498 |         * * * * * * * *                 * * * * * * * *
 | 
|  |    499 |        *               *               *               *
 | 
|  |    500 |       * *             * *             * *             * *
 | 
|  |    501 |      *   *           *   *           *   *           *   *
 | 
|  |    502 |     * * * *         * * * *         * * * *         * * * *
 | 
|  |    503 |    *       *       *       *       *       *       *       *
 | 
|  |    504 |   * *     * *     * *     * *     * *     * *     * *     * *
 | 
|  |    505 |  *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *
 | 
|  |    506 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 | 
|  |    507 | \end{verbatim}}
 | 
|  |    508 | 
 | 
|  |    509 | 
 | 
|  |    510 | \begin{textblock}{6}(8.5,3.5)
 | 
|  |    511 | \begin{bubble}[5cm]
 | 
|  |    512 | \footnotesize
 | 
|  |    513 | \begin{lstlisting}[language=Scala, numbers=none, xleftmargin=-1mm]
 | 
|  |    514 | ++++++++[>+>++++<<-]>++>>
 | 
|  |    515 | +<[-[>>+<<-]+>>]>+[-<<<[-
 | 
|  |    516 | >[+[-]+>++>>>-<<]<[<]>>++
 | 
|  |    517 | ++++[<<+++++>>-]+<<++.[-]
 | 
|  |    518 | <<]>.>+[>>]>+]
 | 
|  |    519 | \end{lstlisting}
 | 
|  |    520 | \end{bubble}
 | 
|  |    521 | \end{textblock}
 | 
|  |    522 |   
 | 
|  |    523 | \end{frame}
 | 
|  |    524 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
 | 
|  |    525 | 
 | 
| 328 |    526 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
| 239 |    527 | 
 | 
|  |    528 | \end{document}
 | 
|  |    529 | 
 | 
|  |    530 | %%% Local Variables:  
 | 
|  |    531 | %%% mode: latex
 | 
|  |    532 | %%% TeX-master: t
 | 
|  |    533 | %%% End: 
 | 
|  |    534 | 
 |