| 325 |      1 | % !TEX program = xelatex
 | 
| 66 |      2 | \documentclass[dvipsnames,14pt,t,xelatex]{beamer}
 | 
|  |      3 | \usepackage{../slides}
 | 
|  |      4 | \usepackage{../graphics}
 | 
|  |      5 | \usepackage{../langs}
 | 
| 155 |      6 | %%\usepackage{../data}
 | 
| 67 |      7 | \usepackage[export]{adjustbox}
 | 
| 222 |      8 | \usetikzlibrary{shapes}
 | 
| 66 |      9 | 
 | 
|  |     10 | \hfuzz=220pt 
 | 
|  |     11 | 
 | 
|  |     12 | %\setmonofont[Scale=.88]{Consolas}
 | 
|  |     13 | %\newfontfamily{\consolas}{Consolas}
 | 
|  |     14 | 
 | 
|  |     15 | \lstset{language=Scala,
 | 
|  |     16 |         style=mystyle,
 | 
|  |     17 |         numbersep=0pt,
 | 
|  |     18 |         numbers=none,
 | 
|  |     19 |         xleftmargin=0mm}
 | 
|  |     20 | 
 | 
| 222 |     21 | \newcommand{\LEFTarrow}[3]{%
 | 
|  |     22 | \begin{textblock}{0}(#2,#3)%
 | 
|  |     23 | \onslide<#1>{%
 | 
|  |     24 | \begin{tikzpicture}%
 | 
|  |     25 | \node at (0,0) [single arrow, shape border rotate=180, fill=red,text=red]{a};%
 | 
|  |     26 | \end{tikzpicture}}%
 | 
|  |     27 | \end{textblock}}
 | 
|  |     28 | \newcommand{\DOWNarrow}[3]{%
 | 
|  |     29 | \begin{textblock}{0}(#2,#3)%
 | 
|  |     30 | \onslide<#1>{%
 | 
|  |     31 | \begin{tikzpicture}%
 | 
|  |     32 | \node at (0,0) [single arrow, shape border rotate=270, fill=red,text=red]{a};%
 | 
|  |     33 | \end{tikzpicture}}%
 | 
|  |     34 | \end{textblock}}
 | 
|  |     35 | 
 | 
|  |     36 | 
 | 
| 66 |     37 | \newcommand{\bl}[1]{\textcolor{blue}{#1}}     
 | 
|  |     38 | 
 | 
|  |     39 | % beamer stuff 
 | 
| 222 |     40 | \renewcommand{\slidecaption}{PEP (Scala) 04, King's College London}
 | 
| 66 |     41 | 
 | 
| 415 |     42 | % Swift, example (a*)*b  
 | 
|  |     43 | \begin{filecontents}{re-swift.data}
 | 
|  |     44 | 5   0.001
 | 
|  |     45 | 10  0.001
 | 
|  |     46 | 15  0.009
 | 
|  |     47 | 20  0.178
 | 
|  |     48 | 23  1.399
 | 
|  |     49 | 24  2.893
 | 
|  |     50 | 25  5.671
 | 
|  |     51 | 26  11.357
 | 
|  |     52 | 27  22.430
 | 
|  |     53 | \end{filecontents}
 | 
|  |     54 | 
 | 
|  |     55 | % Dart, example (a*)*b  
 | 
|  |     56 | \begin{filecontents}{re-dart.data}
 | 
|  |     57 | 20 0.042
 | 
|  |     58 | 21 0.084
 | 
|  |     59 | 22 0.190
 | 
|  |     60 | 23 0.340
 | 
|  |     61 | 24 0.678
 | 
|  |     62 | 25 1.369
 | 
|  |     63 | 26 2.700
 | 
|  |     64 | 27 5.462
 | 
|  |     65 | 28 10.908
 | 
|  |     66 | 29 21.725
 | 
|  |     67 | 30 43.492
 | 
|  |     68 | \end{filecontents}
 | 
|  |     69 | 
 | 
|  |     70 | 
 | 
| 155 |     71 | \begin{filecontents}{re3a.data}
 | 
|  |     72 | 1 0.00003
 | 
|  |     73 | 500001 0.22527
 | 
|  |     74 | 1000001 0.62752
 | 
|  |     75 | 1500001 0.88485
 | 
|  |     76 | 2000001 1.39815
 | 
|  |     77 | 2500001 1.68619
 | 
|  |     78 | 3000001 1.94957
 | 
|  |     79 | 3500001 2.15878
 | 
|  |     80 | 4000001 2.59918
 | 
|  |     81 | 4500001 5.90679
 | 
|  |     82 | 5000001 13.11295
 | 
|  |     83 | 5500001 19.15376
 | 
|  |     84 | 6000001 40.16373
 | 
|  |     85 | \end{filecontents}
 | 
|  |     86 | \begin{filecontents}{re-python2.data}
 | 
|  |     87 | 1 0.033
 | 
|  |     88 | 5 0.036
 | 
|  |     89 | 10 0.034
 | 
|  |     90 | 15 0.036
 | 
|  |     91 | 18 0.059
 | 
|  |     92 | 19 0.084
 | 
|  |     93 | 20 0.141
 | 
|  |     94 | 21 0.248
 | 
|  |     95 | 22 0.485
 | 
|  |     96 | 23 0.878
 | 
|  |     97 | 24 1.71
 | 
|  |     98 | 25 3.40
 | 
|  |     99 | 26 7.08
 | 
|  |    100 | 27 14.12
 | 
|  |    101 | 28 26.69
 | 
|  |    102 | \end{filecontents}
 | 
|  |    103 | 
 | 
| 222 |    104 | \begin{filecontents}{re-js.data}
 | 
|  |    105 | 5   0.061
 | 
|  |    106 | 10  0.061
 | 
|  |    107 | 15  0.061
 | 
|  |    108 | 20  0.070
 | 
|  |    109 | 23  0.131
 | 
|  |    110 | 25  0.308
 | 
|  |    111 | 26  0.564
 | 
|  |    112 | 28  1.994
 | 
|  |    113 | 30  7.648
 | 
|  |    114 | 31  15.881 
 | 
|  |    115 | 32  32.190
 | 
|  |    116 | \end{filecontents}
 | 
|  |    117 | 
 | 
| 155 |    118 | \begin{filecontents}{re-java.data}
 | 
|  |    119 | 5  0.00298
 | 
|  |    120 | 10  0.00418
 | 
|  |    121 | 15  0.00996
 | 
|  |    122 | 16  0.01710
 | 
|  |    123 | 17  0.03492
 | 
|  |    124 | 18  0.03303
 | 
|  |    125 | 19  0.05084
 | 
|  |    126 | 20  0.10177
 | 
|  |    127 | 21  0.19960
 | 
|  |    128 | 22  0.41159
 | 
|  |    129 | 23  0.82234
 | 
|  |    130 | 24  1.70251
 | 
|  |    131 | 25  3.36112
 | 
|  |    132 | 26  6.63998
 | 
|  |    133 | 27  13.35120
 | 
|  |    134 | 28  29.81185
 | 
|  |    135 | \end{filecontents}
 | 
| 66 |    136 | 
 | 
| 222 |    137 | \begin{filecontents}{re-java9.data}
 | 
|  |    138 | 1000  0.01410
 | 
|  |    139 | 2000  0.04882
 | 
|  |    140 | 3000  0.10609
 | 
|  |    141 | 4000  0.17456
 | 
|  |    142 | 5000  0.27530
 | 
|  |    143 | 6000  0.41116
 | 
|  |    144 | 7000  0.53741
 | 
|  |    145 | 8000  0.70261
 | 
|  |    146 | 9000  0.93981
 | 
|  |    147 | 10000 0.97419
 | 
|  |    148 | 11000 1.28697
 | 
|  |    149 | 12000 1.51387
 | 
|  |    150 | 14000 2.07079
 | 
|  |    151 | 16000 2.69846
 | 
|  |    152 | 20000 4.41823
 | 
|  |    153 | 24000 6.46077
 | 
|  |    154 | 26000 7.64373
 | 
|  |    155 | 30000 9.99446
 | 
|  |    156 | 34000 12.966885
 | 
|  |    157 | 38000 16.281621
 | 
|  |    158 | 42000 19.180228
 | 
|  |    159 | 46000 21.984721
 | 
|  |    160 | 50000 26.950203
 | 
|  |    161 | 60000 43.0327746
 | 
|  |    162 | \end{filecontents}
 | 
|  |    163 | 
 | 
|  |    164 | 
 | 
| 66 |    165 | \begin{document}
 | 
|  |    166 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    167 | \begin{frame}[t]
 | 
|  |    168 | \frametitle{%
 | 
|  |    169 |   \begin{tabular}{@ {}c@ {}}
 | 
|  |    170 |   \\[5mm]
 | 
| 222 |    171 |   \huge PEP Scala (4) 
 | 
| 66 |    172 |   \end{tabular}}
 | 
|  |    173 | 
 | 
|  |    174 |   \normalsize
 | 
|  |    175 |   \begin{center}
 | 
|  |    176 |   \begin{tabular}{ll}
 | 
| 155 |    177 |     Email:  & christian.urban at kcl.ac.uk\\
 | 
| 413 |    178 |     %Office: & N\liningnums{7.07} (North Wing, Bush House)\bigskip\\
 | 
|  |    179 |     Slides \& Code: & KEATS\bigskip\\
 | 
|  |    180 |     %Office Hours: &  Thursdays 12:00 -- 14:00\\
 | 
|  |    181 |     %Additionally: & (for Scala) Tuesdays 10:45 -- 11:45\\
 | 
| 415 |    182 |     \multicolumn{2}{c}{\Large\textbf{https://pollev.com/cfltutoratki576}}\\[2cm]
 | 
|  |    183 |     \textcolor{red}{Scala Install Clinic:} & \textcolor{red}{This evening at 17:00 (online)}\\
 | 
| 66 |    184 |   \end{tabular}
 | 
|  |    185 |   \end{center}
 | 
|  |    186 | 
 | 
|  |    187 | \end{frame}
 | 
|  |    188 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
 | 
|  |    189 | 
 | 
| 325 |    190 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
| 222 |    191 | \begin{frame}[c]
 | 
| 325 |    192 | \frametitle{Hints in CW}
 | 
| 222 |    193 | 
 | 
| 325 |    194 | \begin{center}  
 | 
|  |    195 | \includegraphics[scale=0.4]{../pics/hints.png}
 | 
| 222 |    196 | \end{center}
 | 
|  |    197 | 
 | 
| 325 |    198 | \small
 | 
|  |    199 | \begin{itemize}
 | 
|  |    200 |   \item Scala Library, e.g.~\texttt{span} in \\
 | 
|  |    201 |   \url{https://www.scala-lang.org/api/current/scala/collection/immutable/List.html}
 | 
|  |    202 | \end{itemize}
 | 
|  |    203 | \end{frame}
 | 
|  |    204 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    205 |   
 | 
| 326 |    206 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    207 | \begin{frame}[c]
 | 
|  |    208 | \frametitle{Discussion Forum}
 | 
| 222 |    209 | 
 | 
| 326 |    210 | \begin{center}  
 | 
|  |    211 | \includegraphics[scale=0.38]{/Users/cu/discussion.png}
 | 
|  |    212 | \end{center}
 | 
|  |    213 | 
 | 
|  |    214 | \end{frame}
 | 
|  |    215 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
| 222 |    216 | 
 | 
|  |    217 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
 | 
| 415 |    218 | % \begin{frame}[c]
 | 
|  |    219 | % \frametitle{Preliminary 7}
 | 
| 222 |    220 | 
 | 
| 415 |    221 | % Raw marks (261 submissions):\bigskip
 | 
| 222 |    222 | 
 | 
| 415 |    223 | % \begin{itemize}
 | 
|  |    224 | % \item 4\%: \hspace{4mm}236
 | 
|  |    225 | % \item 3\%: \hspace{4mm}10
 | 
|  |    226 | % \item 2\%: \hspace{4mm}1
 | 
|  |    227 | % \item 1\%: \hspace{4mm}0
 | 
|  |    228 | % \item 0\%: \hspace{4mm}15 
 | 
|  |    229 | % \end{itemize}\bigskip\bigskip  
 | 
| 222 |    230 | 
 | 
| 415 |    231 | % \footnotesize
 | 
|  |    232 | % (plagiarism/collusion interviews ongoing!)
 | 
| 222 |    233 | 
 | 
| 415 |    234 | % \end{frame}
 | 
| 222 |    235 | 
 | 
|  |    236 | 
 | 
|  |    237 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
| 66 |    238 | 
 | 
| 325 |    239 | 
 | 
| 66 |    240 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
| 415 |    241 | % \begin{frame}[c,fragile]
 | 
|  |    242 | % \small
 | 
| 222 |    243 |   
 | 
| 415 |    244 | % \begin{lstlisting}[language=Scala, numbers=none, xleftmargin=1mm]
 | 
|  |    245 | % def is_legal(dim: Int, p: Path, x: Pos) = {
 | 
|  |    246 | %   if (...some_really_long_condition...) false
 | 
|  |    247 | %   else true
 | 
|  |    248 | % }
 | 
|  |    249 | % \end{lstlisting}
 | 
| 67 |    250 | 
 | 
| 415 |    251 | % \pause
 | 
|  |    252 | % \bigskip
 | 
|  |    253 | % \rule{11cm}{0.3mm}
 | 
|  |    254 | % \bigskip
 | 
| 222 |    255 | 
 | 
| 415 |    256 | % \begin{lstlisting}[language=Scala, numbers=none, xleftmargin=1mm]
 | 
|  |    257 | % def is_legal(dim: Int, p: Path, x: Pos) = 
 | 
|  |    258 | %   !(...some_really_long_condition...)
 | 
|  |    259 | % \end{lstlisting}
 | 
| 325 |    260 | 
 | 
| 415 |    261 | % \end{frame}
 | 
| 325 |    262 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
 | 
|  |    263 | 
 | 
|  |    264 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
| 415 |    265 | % \begin{frame}[c,fragile]
 | 
|  |    266 | % \small
 | 
| 325 |    267 |   
 | 
| 415 |    268 | % \begin{lstlisting}[language=Scala, numbers=none, xleftmargin=1mm]
 | 
|  |    269 | % def foobar(...) = {
 | 
|  |    270 | %   val cs = for (c <- str) yield c.toLowerCase
 | 
|  |    271 | %   ...
 | 
|  |    272 | % }
 | 
|  |    273 | % \end{lstlisting}
 | 
| 325 |    274 | 
 | 
| 415 |    275 | % \pause
 | 
|  |    276 | % \bigskip
 | 
|  |    277 | % \rule{11cm}{0.3mm}
 | 
|  |    278 | % \bigskip
 | 
| 325 |    279 | 
 | 
| 415 |    280 | % \begin{lstlisting}[language=Scala, numbers=none, xleftmargin=1mm]
 | 
|  |    281 | % def foobar(...) = {
 | 
|  |    282 | %   val cs = str.map(_.toLowerCase)
 | 
|  |    283 | %   ...
 | 
|  |    284 | % }
 | 
|  |    285 | % \end{lstlisting}
 | 
| 325 |    286 | 
 | 
| 415 |    287 | % \end{frame}
 | 
| 325 |    288 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
 | 
|  |    289 | 
 | 
|  |    290 | 
 | 
|  |    291 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
| 415 |    292 | % \begin{frame}[c,fragile]
 | 
|  |    293 | % \small
 | 
| 325 |    294 |   
 | 
| 415 |    295 | % \begin{lstlisting}[language=Scala, numbers=none, xleftmargin=-7mm]
 | 
|  |    296 | % def RomanNumeral2Int(rs: RomanNumeral): Int = 
 | 
|  |    297 | %  rs match { 
 | 
|  |    298 | %    case Nil => 0
 | 
|  |    299 | %    case M::r    => 1000 + RomanNumeral2Int(r)  
 | 
|  |    300 | %    case C::M::r => 900 + RomanNumeral2Int(r)
 | 
|  |    301 | %    case D::r    => 500 + RomanNumeral2Int(r)
 | 
|  |    302 | %    case C::D::r => 400 + RomanNumeral2Int(r)
 | 
|  |    303 | %    case C::r    => 100 + RomanNumeral2Int(r)
 | 
|  |    304 | %    case X::C::r => 90 + RomanNumeral2Int(r)
 | 
|  |    305 | %    case L::r    => 50 + RomanNumeral2Int(r)
 | 
|  |    306 | %    case X::L::r => 40 + RomanNumeral2Int(r)
 | 
|  |    307 | %    case X::r    => 10 + RomanNumeral2Int(r)
 | 
|  |    308 | %    case I::X::r => 9 + RomanNumeral2Int(r)
 | 
|  |    309 | %    case V::r    => 5 + RomanNumeral2Int(r)
 | 
|  |    310 | %    case I::V::r => 4 + RomanNumeral2Int(r)
 | 
|  |    311 | %    case I::r    => 1 + RomanNumeral2Int(r)
 | 
|  |    312 | %  }
 | 
|  |    313 | % \end{lstlisting}
 | 
| 67 |    314 | 
 | 
| 415 |    315 | % \end{frame}
 | 
| 67 |    316 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
 | 
|  |    317 | 
 | 
|  |    318 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
| 325 |    319 | \begin{frame}[c,fragile]
 | 
|  |    320 | \frametitle{Last Week: Pattern Matching} 
 | 
|  |    321 | \small
 | 
|  |    322 |   
 | 
|  |    323 | \begin{lstlisting}[language=Scala, numbers=none, xleftmargin=3mm]
 | 
|  |    324 | def fizz_buzz(n: Int) : String = 
 | 
|  |    325 |   (n % 3, n % 5) match {
 | 
|  |    326 |     case (0, 0) => "fizz buzz"
 | 
|  |    327 |     case (0, _) => "fizz"
 | 
|  |    328 |     case (_, 0) => "buzz"
 | 
|  |    329 |     case _ => n.toString  
 | 
|  |    330 |   }
 | 
|  |    331 | \end{lstlisting}
 | 
|  |    332 | 
 | 
|  |    333 | \end{frame}
 | 
|  |    334 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
 | 
|  |    335 | 
 | 
|  |    336 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
 | 
|  |    337 | \begin{frame}[c,fragile]
 | 
|  |    338 | \frametitle{Reverse Polish Notation}
 | 
|  |    339 | 
 | 
|  |    340 | {\Large\bl{$(3 + 1) * (2 + 9)$}}\bigskip
 | 
|  |    341 | 
 | 
|  |    342 | {\Large$\Rightarrow$}\bigskip
 | 
|  |    343 | 
 | 
|  |    344 | {\;\;\Large\bl{$3\;\;1\;+\;2\;\;9\;+\;*$}}
 | 
|  |    345 | 
 | 
|  |    346 | \begin{textblock}{3}(11,4)
 | 
|  |    347 | \begin{onlyenv}<2>
 | 
|  |    348 | \begin{lstlisting}[language=JVMIS]
 | 
|  |    349 | ldc 3
 | 
|  |    350 | ldc 1
 | 
|  |    351 | iadd
 | 
|  |    352 | ldc 2
 | 
|  |    353 | ldc 9
 | 
|  |    354 | iadd
 | 
|  |    355 | imul
 | 
|  |    356 | \end{lstlisting}
 | 
|  |    357 | \end{onlyenv} 
 | 
|  |    358 | \end{textblock}
 | 
|  |    359 | 
 | 
|  |    360 | \end{frame}
 | 
|  |    361 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    362 |  
 | 
|  |    363 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
 | 
| 415 |    364 | % \begin{frame}[c,fragile]
 | 
|  |    365 | % \frametitle{Sudoku}
 | 
| 325 |    366 | 
 | 
| 415 |    367 | % A very simple-minded version on 110 problems:\bigskip
 | 
| 325 |    368 | 
 | 
| 415 |    369 | % \begin{itemize}
 | 
|  |    370 | % \item 1 core: 800 secs
 | 
|  |    371 | % \item 2 cores: 400 secs
 | 
|  |    372 | % \item 8 cores: 290 secs
 | 
|  |    373 | % \item 18 cores: 142 secs
 | 
|  |    374 | % \end{itemize}
 | 
| 325 |    375 | 
 | 
| 415 |    376 | % \end{frame}
 | 
| 325 |    377 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    378 |  
 | 
| 155 |    379 | 
 | 
| 325 |    380 | 
 | 
| 415 |    381 | % \begin{frame}[t]
 | 
| 325 |    382 | 
 | 
| 415 |    383 | %   \begin{center}  
 | 
|  |    384 | %   \includegraphics[scale=0.3]{../pics/blow.png}
 | 
|  |    385 | %   \end{center}
 | 
| 325 |    386 |   
 | 
| 415 |    387 | %   \begin{textblock}{14}(2,11.4)
 | 
|  |    388 | %   \large\bf{}Mind-Blowing Regular Expressions:\\ 
 | 
|  |    389 | %   \centering in Python, JavaScript, Java
 | 
|  |    390 | %   \end{textblock}
 | 
|  |    391 | % \end{frame}
 | 
| 67 |    392 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
| 325 |    393 | 
 | 
|  |    394 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    395 | \begin{frame}[c,fragile]
 | 
|  |    396 | \frametitle{Regular Expressions} 
 | 
|  |    397 |   
 | 
| 326 |    398 | Suppose you have the regular expression 
 | 
| 325 |    399 | \only<1-3>{\alert{\texttt{(a*)b}}}%
 | 
|  |    400 | \only<4->{\alert{\texttt{(a*)*b}}} :\bigskip
 | 
|  |    401 | 
 | 
|  |    402 | \begin{center}
 | 
|  |    403 | \only<1>{\code{"aaaaaaaaaaaaaaab"}}
 | 
|  |    404 | \only<2>{\code{"aaaaa...........aaaaaaaaaaaaaaaaaaaab"}}
 | 
|  |    405 | \only<3>{\code{"aaaaa...........aaaaaaaaaaaaaaaaaaaa"}}
 | 
|  |    406 | \only<4>{\code{"aaaaa...........aaaaaaaaaaaaaaaaaaaab"}}
 | 
|  |    407 | \only<5->{\code{"aaaaa...........aaaaaaaaaaaaaaaaaaaa"}}
 | 
|  |    408 | \end{center}
 | 
|  |    409 | 
 | 
|  |    410 | \only<6>{
 | 
|  |    411 | \begin{textblock}{13}(5,12)
 | 
|  |    412 | How long does Python need to find out?
 | 
|  |    413 | \end{textblock}}
 | 
|  |    414 | 
 | 
|  |    415 | \end{frame}
 | 
|  |    416 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
 | 
|  |    417 | 
 | 
|  |    418 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    419 | \begin{frame}<1>[c]
 | 
| 415 |    420 |   \frametitle{Main 3: Regexes}
 | 
| 68 |    421 |   
 | 
|  |    422 | \begin{center}
 | 
| 415 |    423 |   \mbox{Graphs: regex \alert{\texttt{(a*)*b}} and strings $\underbrace{\;\texttt{a}\ldots \texttt{a}\;}_{n}$}\bigskip
 | 
|  |    424 | 
 | 
|  |    425 | 
 | 
|  |    426 |   \small  
 | 
|  |    427 | \begin{tabular}[t]{@{\hspace{-8mm}}c@{\hspace{-0mm}}c@{}}
 | 
| 222 |    428 | \only<1>{\raisebox{6mm}{\begin{tikzpicture}
 | 
| 68 |    429 | \begin{axis}[
 | 
|  |    430 |     xlabel={$n$},
 | 
|  |    431 |     x label style={at={(1.05,0.0)}},
 | 
|  |    432 |     ylabel={time in secs},
 | 
|  |    433 |     enlargelimits=false,
 | 
|  |    434 |     xtick={0,5,...,30},
 | 
|  |    435 |     xmax=33,
 | 
|  |    436 |     ymax=35,
 | 
|  |    437 |     ytick={0,5,...,30},
 | 
|  |    438 |     scaled ticks=false,
 | 
|  |    439 |     axis lines=left,
 | 
|  |    440 |     width=5.5cm,
 | 
| 415 |    441 |     height=5cm,
 | 
|  |    442 |     legend entries={Java 8,Python,JavaScript,Swift,Dart},
 | 
|  |    443 |     %legend entries={\small{}Python,  \small{}Java 8,  \small{}JavaScript},  
 | 
| 68 |    444 |     legend pos=north west,
 | 
|  |    445 |     legend cell align=left]
 | 
|  |    446 | \addplot[blue,mark=*, mark options={fill=white}] table {re-python2.data};  
 | 
|  |    447 | \addplot[cyan,mark=*, mark options={fill=white}] table {re-java.data};
 | 
| 222 |    448 | \addplot[red,mark=*, mark options={fill=white}] table {re-js.data};
 | 
| 415 |    449 | \addplot[magenta,mark=*, mark options={fill=white}] table {re-swift.data};
 | 
|  |    450 | \addplot[brown,mark=*, mark options={fill=white}] table {re-dart.data};
 | 
| 68 |    451 | \end{axis}
 | 
| 222 |    452 | \end{tikzpicture}}}%
 | 
|  |    453 | \only<2>{\raisebox{0mm}{\begin{tikzpicture}
 | 
|  |    454 | \begin{axis}[
 | 
|  |    455 |     xlabel={$n$},
 | 
|  |    456 |     x label style={at={(1.05,0.0)}},
 | 
|  |    457 |     ylabel={time in secs},
 | 
|  |    458 |     %y label style={at={(0.06,0.5)}},
 | 
|  |    459 |     enlargelimits=false,
 | 
|  |    460 |     %xtick={0,30000,...,60000},
 | 
|  |    461 |     xmax=65000,
 | 
|  |    462 |     ymax=35,
 | 
|  |    463 |     ytick={0,5,...,30},
 | 
|  |    464 |     scaled ticks=true,
 | 
|  |    465 |     axis lines=left,
 | 
|  |    466 |     width=5.5cm,
 | 
|  |    467 |     height=5cm, 
 | 
|  |    468 |     legend entries={\small{}Java 9},  
 | 
|  |    469 |     legend pos=north west]
 | 
|  |    470 | \addplot[cyan,mark=*, mark options={fill=white}] table {re-java9.data};
 | 
|  |    471 | \end{axis}
 | 
|  |    472 | \end{tikzpicture}}}
 | 
| 68 |    473 |   &
 | 
| 222 |    474 | \onslide<1-2>{\begin{tikzpicture}
 | 
| 68 |    475 |   \begin{axis}[
 | 
|  |    476 |     xlabel={$n$},
 | 
|  |    477 |     x label style={at={(1.05,0.0)}},
 | 
|  |    478 |     ylabel={time in secs},
 | 
|  |    479 |     enlargelimits=false,
 | 
|  |    480 |     ymax=35,
 | 
|  |    481 |     ytick={0,5,...,30},
 | 
|  |    482 |     axis lines=left,
 | 
| 415 |    483 |     legend entries={You in M3}, 
 | 
| 68 |    484 |     %%scaled ticks=false,
 | 
|  |    485 |     width=5.5cm, 
 | 
|  |    486 |     height=5cm]
 | 
|  |    487 | %%\addplot[green,mark=square*,mark options={fill=white}] table {re2a.data};    
 | 
| 222 |    488 | \addplot[magenta,mark=square*,mark options={fill=white}] table {re3a.data};
 | 
| 68 |    489 | \end{axis}
 | 
| 70 |    490 | \end{tikzpicture}}
 | 
| 68 |    491 | \end{tabular}
 | 
|  |    492 | \end{center}
 | 
| 66 |    493 | 
 | 
| 68 |    494 | \hfill\small\url{https://vimeo.com/112065252}
 | 
| 66 |    495 | \end{frame}
 | 
| 325 |    496 | 
 | 
|  |    497 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
| 67 |    498 | 
 | 
| 415 |    499 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
 | 
|  |    500 | \begin{frame}[c,fragile]
 | 
|  |    501 | \small
 | 
|  |    502 | \textcolor{red}{MacOSX}\medskip
 | 
| 70 |    503 | 
 | 
| 415 |    504 | \begin{minipage}{13cm}
 | 
|  |    505 |   \begin{itemize}
 | 
|  |    506 |   \item[0)] (if needed) \texttt{brew install java} \;\;or\;\; \texttt{brew reinstall java}
 | 
|  |    507 |   \item[1)] \texttt{curl -s "https://get.sdkman.io" | bash}
 | 
|  |    508 |   \item[2)] \texttt{sdk install scala 2.13.7}  
 | 
|  |    509 |   \end{itemize}
 | 
|  |    510 | \end{minipage}\bigskip
 | 
|  |    511 |   
 | 
|  |    512 | \textcolor{red}{Windows / Linux Ubuntu}\medskip
 | 
|  |    513 | 
 | 
|  |    514 | \begin{minipage}{13cm}
 | 
|  |    515 |   \begin{itemize}
 | 
|  |    516 |   \item[0)] (if needed) \texttt{sudo apt-get remove scala-library scala}
 | 
|  |    517 |   \item[1)] {\fontsize{8.5}{8.5}\selectfont\texttt{sudo wget https://downloads.lightbend.com/scala/2.13.7/scala-2.13.7.deb}}
 | 
|  |    518 |   \item[2)] \texttt{sudo dpkg -i scala-2.13.7.deb}  
 | 
|  |    519 |   \end{itemize}
 | 
|  |    520 | \end{minipage}\bigskip
 | 
|  |    521 | 
 | 
|  |    522 | \begin{minipage}{13cm}
 | 
|  |    523 | other Linux distros: \texttt{sudo apt-get scala}
 | 
|  |    524 | \end{minipage}
 | 
|  |    525 | 
 | 
|  |    526 | \end{frame}
 | 
|  |    527 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
| 66 |    528 | 
 | 
|  |    529 | 
 | 
|  |    530 | \end{document}
 | 
|  |    531 | 
 | 
|  |    532 | %%% Local Variables:  
 | 
|  |    533 | %%% mode: latex
 | 
|  |    534 | %%% TeX-master: t
 | 
|  |    535 | %%% End: 
 | 
|  |    536 | 
 |