| 325 |      1 | % !TEX program = xelatex
 | 
| 446 |      2 | \documentclass[dvipsnames,14pt,t,xelatex,aspectratio=169,xcolor={table}]{beamer}
 | 
|  |      3 | \usepackage{../styles/slides}
 | 
|  |      4 | \usepackage{../styles/mygraphs}
 | 
|  |      5 | \usepackage{../styles/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\\
 | 
| 478 |    178 |     %%Office: & N\liningnums{7.07} (North Wing, Bush House)\bigskip\\
 | 
| 413 |    179 |     Slides \& Code: & KEATS\bigskip\\
 | 
| 446 |    180 | 
 | 
| 478 |    181 |     Office Hour: &  Fridays 13:00 -- 14:00\\
 | 
| 446 |    182 |     Location: & N7.07 (North Wing, Bush House)\bigskip\\
 | 
|  |    183 | 
 | 
|  |    184 |     Pollev: & \texttt{\alert{https://pollev.com/cfltutoratki576}}\\  \\
 | 
| 66 |    185 |   \end{tabular}
 | 
|  |    186 |   \end{center}
 | 
|  |    187 | 
 | 
|  |    188 | \end{frame}
 | 
|  |    189 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
 | 
|  |    190 | 
 | 
| 325 |    191 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
| 446 |    192 | %\begin{frame}[c]
 | 
|  |    193 | %\frametitle{Hints in CW}
 | 
|  |    194 | %
 | 
|  |    195 | %\begin{center}  
 | 
|  |    196 | %\includegraphics[scale=0.4]{../pics/hints.png}
 | 
|  |    197 | %\end{center}
 | 
|  |    198 | %
 | 
|  |    199 | %\small
 | 
|  |    200 | %\begin{itemize}
 | 
|  |    201 | %  \item Scala Library, e.g.~\texttt{span} in \\
 | 
|  |    202 | %  \url{https://www.scala-lang.org/api/current/scala/collection/immutable/List.html}
 | 
|  |    203 | %\end{itemize}
 | 
|  |    204 | %\end{frame}
 | 
| 325 |    205 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    206 |   
 | 
| 326 |    207 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
| 446 |    208 | %\begin{frame}[c]
 | 
|  |    209 | %\frametitle{Discussion Forum}
 | 
| 222 |    210 | 
 | 
| 446 |    211 | %\begin{center}  
 | 
|  |    212 | %\includegraphics[scale=0.38]{/Users/cu/discussion.png}
 | 
|  |    213 | %\end{center}
 | 
| 326 |    214 | 
 | 
| 446 |    215 | %\end{frame}
 | 
| 326 |    216 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
| 222 |    217 | 
 | 
|  |    218 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
 | 
| 415 |    219 | % \begin{frame}[c]
 | 
|  |    220 | % \frametitle{Preliminary 7}
 | 
| 222 |    221 | 
 | 
| 415 |    222 | % Raw marks (261 submissions):\bigskip
 | 
| 222 |    223 | 
 | 
| 415 |    224 | % \begin{itemize}
 | 
|  |    225 | % \item 4\%: \hspace{4mm}236
 | 
|  |    226 | % \item 3\%: \hspace{4mm}10
 | 
|  |    227 | % \item 2\%: \hspace{4mm}1
 | 
|  |    228 | % \item 1\%: \hspace{4mm}0
 | 
|  |    229 | % \item 0\%: \hspace{4mm}15 
 | 
|  |    230 | % \end{itemize}\bigskip\bigskip  
 | 
| 222 |    231 | 
 | 
| 415 |    232 | % \footnotesize
 | 
|  |    233 | % (plagiarism/collusion interviews ongoing!)
 | 
| 222 |    234 | 
 | 
| 415 |    235 | % \end{frame}
 | 
| 222 |    236 | 
 | 
|  |    237 | 
 | 
|  |    238 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
| 66 |    239 | 
 | 
| 325 |    240 | 
 | 
| 66 |    241 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
| 415 |    242 | % \begin{frame}[c,fragile]
 | 
|  |    243 | % \small
 | 
| 222 |    244 |   
 | 
| 415 |    245 | % \begin{lstlisting}[language=Scala, numbers=none, xleftmargin=1mm]
 | 
|  |    246 | % def is_legal(dim: Int, p: Path, x: Pos) = {
 | 
|  |    247 | %   if (...some_really_long_condition...) false
 | 
|  |    248 | %   else true
 | 
|  |    249 | % }
 | 
|  |    250 | % \end{lstlisting}
 | 
| 67 |    251 | 
 | 
| 415 |    252 | % \pause
 | 
|  |    253 | % \bigskip
 | 
|  |    254 | % \rule{11cm}{0.3mm}
 | 
|  |    255 | % \bigskip
 | 
| 222 |    256 | 
 | 
| 415 |    257 | % \begin{lstlisting}[language=Scala, numbers=none, xleftmargin=1mm]
 | 
|  |    258 | % def is_legal(dim: Int, p: Path, x: Pos) = 
 | 
|  |    259 | %   !(...some_really_long_condition...)
 | 
|  |    260 | % \end{lstlisting}
 | 
| 325 |    261 | 
 | 
| 415 |    262 | % \end{frame}
 | 
| 325 |    263 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
 | 
|  |    264 | 
 | 
|  |    265 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
| 415 |    266 | % \begin{frame}[c,fragile]
 | 
|  |    267 | % \small
 | 
| 325 |    268 |   
 | 
| 415 |    269 | % \begin{lstlisting}[language=Scala, numbers=none, xleftmargin=1mm]
 | 
|  |    270 | % def foobar(...) = {
 | 
|  |    271 | %   val cs = for (c <- str) yield c.toLowerCase
 | 
|  |    272 | %   ...
 | 
|  |    273 | % }
 | 
|  |    274 | % \end{lstlisting}
 | 
| 325 |    275 | 
 | 
| 415 |    276 | % \pause
 | 
|  |    277 | % \bigskip
 | 
|  |    278 | % \rule{11cm}{0.3mm}
 | 
|  |    279 | % \bigskip
 | 
| 325 |    280 | 
 | 
| 415 |    281 | % \begin{lstlisting}[language=Scala, numbers=none, xleftmargin=1mm]
 | 
|  |    282 | % def foobar(...) = {
 | 
|  |    283 | %   val cs = str.map(_.toLowerCase)
 | 
|  |    284 | %   ...
 | 
|  |    285 | % }
 | 
|  |    286 | % \end{lstlisting}
 | 
| 325 |    287 | 
 | 
| 415 |    288 | % \end{frame}
 | 
| 325 |    289 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
 | 
|  |    290 | 
 | 
|  |    291 | 
 | 
|  |    292 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
| 415 |    293 | % \begin{frame}[c,fragile]
 | 
|  |    294 | % \small
 | 
| 325 |    295 |   
 | 
| 415 |    296 | % \begin{lstlisting}[language=Scala, numbers=none, xleftmargin=-7mm]
 | 
|  |    297 | % def RomanNumeral2Int(rs: RomanNumeral): Int = 
 | 
|  |    298 | %  rs match { 
 | 
|  |    299 | %    case Nil => 0
 | 
|  |    300 | %    case M::r    => 1000 + RomanNumeral2Int(r)  
 | 
|  |    301 | %    case C::M::r => 900 + RomanNumeral2Int(r)
 | 
|  |    302 | %    case D::r    => 500 + RomanNumeral2Int(r)
 | 
|  |    303 | %    case C::D::r => 400 + RomanNumeral2Int(r)
 | 
|  |    304 | %    case C::r    => 100 + RomanNumeral2Int(r)
 | 
|  |    305 | %    case X::C::r => 90 + RomanNumeral2Int(r)
 | 
|  |    306 | %    case L::r    => 50 + RomanNumeral2Int(r)
 | 
|  |    307 | %    case X::L::r => 40 + RomanNumeral2Int(r)
 | 
|  |    308 | %    case X::r    => 10 + RomanNumeral2Int(r)
 | 
|  |    309 | %    case I::X::r => 9 + RomanNumeral2Int(r)
 | 
|  |    310 | %    case V::r    => 5 + RomanNumeral2Int(r)
 | 
|  |    311 | %    case I::V::r => 4 + RomanNumeral2Int(r)
 | 
|  |    312 | %    case I::r    => 1 + RomanNumeral2Int(r)
 | 
|  |    313 | %  }
 | 
|  |    314 | % \end{lstlisting}
 | 
| 67 |    315 | 
 | 
| 415 |    316 | % \end{frame}
 | 
| 67 |    317 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
 | 
|  |    318 | 
 | 
|  |    319 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
| 325 |    320 | \begin{frame}[c,fragile]
 | 
|  |    321 | \frametitle{Last Week: Pattern Matching} 
 | 
|  |    322 | \small
 | 
|  |    323 |   
 | 
|  |    324 | \begin{lstlisting}[language=Scala, numbers=none, xleftmargin=3mm]
 | 
|  |    325 | def fizz_buzz(n: Int) : String = 
 | 
|  |    326 |   (n % 3, n % 5) match {
 | 
|  |    327 |     case (0, 0) => "fizz buzz"
 | 
|  |    328 |     case (0, _) => "fizz"
 | 
|  |    329 |     case (_, 0) => "buzz"
 | 
|  |    330 |     case _ => n.toString  
 | 
|  |    331 |   }
 | 
|  |    332 | \end{lstlisting}
 | 
|  |    333 | 
 | 
|  |    334 | \end{frame}
 | 
|  |    335 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
 | 
|  |    336 | 
 | 
| 446 |    337 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    338 | \begin{frame}[c,fragile]
 | 
|  |    339 | \frametitle{Last Week: Pattern Matching} 
 | 
|  |    340 | \small
 | 
|  |    341 | 
 | 
|  |    342 | \begin{lstlisting}[language=Scala, numbers=none, xleftmargin=3mm]
 | 
|  |    343 | def mkeps(r: Rexp) : Val = r match {
 | 
|  |    344 |   case ONE => Empty
 | 
|  |    345 |   case ALT(r1, r2) => ...
 | 
|  |    346 |   case SEQ(r1, r2) => ...
 | 
|  |    347 |   case STAR(r) => ...
 | 
|  |    348 |   case RECD(x, r1) => Rec(x, mkeps(r))
 | 
|  |    349 |   ...
 | 
|  |    350 | }
 | 
|  |    351 | \end{lstlisting}
 | 
|  |    352 | 
 | 
|  |    353 | \end{frame}
 | 
|  |    354 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
 | 
|  |    355 | 
 | 
|  |    356 | 
 | 
| 325 |    357 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
 | 
|  |    358 | \begin{frame}[c,fragile]
 | 
|  |    359 | \frametitle{Reverse Polish Notation}
 | 
|  |    360 | 
 | 
|  |    361 | {\Large\bl{$(3 + 1) * (2 + 9)$}}\bigskip
 | 
|  |    362 | 
 | 
|  |    363 | {\Large$\Rightarrow$}\bigskip
 | 
|  |    364 | 
 | 
|  |    365 | {\;\;\Large\bl{$3\;\;1\;+\;2\;\;9\;+\;*$}}
 | 
|  |    366 | 
 | 
|  |    367 | \begin{textblock}{3}(11,4)
 | 
|  |    368 | \begin{onlyenv}<2>
 | 
|  |    369 | \begin{lstlisting}[language=JVMIS]
 | 
|  |    370 | ldc 3
 | 
|  |    371 | ldc 1
 | 
|  |    372 | iadd
 | 
|  |    373 | ldc 2
 | 
|  |    374 | ldc 9
 | 
|  |    375 | iadd
 | 
|  |    376 | imul
 | 
|  |    377 | \end{lstlisting}
 | 
|  |    378 | \end{onlyenv} 
 | 
|  |    379 | \end{textblock}
 | 
|  |    380 | 
 | 
|  |    381 | \end{frame}
 | 
|  |    382 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    383 |  
 | 
|  |    384 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
 | 
| 415 |    385 | % \begin{frame}[c,fragile]
 | 
|  |    386 | % \frametitle{Sudoku}
 | 
| 325 |    387 | 
 | 
| 415 |    388 | % A very simple-minded version on 110 problems:\bigskip
 | 
| 325 |    389 | 
 | 
| 415 |    390 | % \begin{itemize}
 | 
|  |    391 | % \item 1 core: 800 secs
 | 
|  |    392 | % \item 2 cores: 400 secs
 | 
|  |    393 | % \item 8 cores: 290 secs
 | 
|  |    394 | % \item 18 cores: 142 secs
 | 
|  |    395 | % \end{itemize}
 | 
| 325 |    396 | 
 | 
| 415 |    397 | % \end{frame}
 | 
| 325 |    398 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    399 |  
 | 
| 155 |    400 | 
 | 
| 325 |    401 | 
 | 
| 415 |    402 | % \begin{frame}[t]
 | 
| 325 |    403 | 
 | 
| 415 |    404 | %   \begin{center}  
 | 
|  |    405 | %   \includegraphics[scale=0.3]{../pics/blow.png}
 | 
|  |    406 | %   \end{center}
 | 
| 325 |    407 |   
 | 
| 415 |    408 | %   \begin{textblock}{14}(2,11.4)
 | 
|  |    409 | %   \large\bf{}Mind-Blowing Regular Expressions:\\ 
 | 
|  |    410 | %   \centering in Python, JavaScript, Java
 | 
|  |    411 | %   \end{textblock}
 | 
|  |    412 | % \end{frame}
 | 
| 67 |    413 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
| 325 |    414 | 
 | 
|  |    415 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    416 | \begin{frame}[c,fragile]
 | 
|  |    417 | \frametitle{Regular Expressions} 
 | 
|  |    418 |   
 | 
| 326 |    419 | Suppose you have the regular expression 
 | 
| 325 |    420 | \only<1-3>{\alert{\texttt{(a*)b}}}%
 | 
|  |    421 | \only<4->{\alert{\texttt{(a*)*b}}} :\bigskip
 | 
|  |    422 | 
 | 
|  |    423 | \begin{center}
 | 
|  |    424 | \only<1>{\code{"aaaaaaaaaaaaaaab"}}
 | 
|  |    425 | \only<2>{\code{"aaaaa...........aaaaaaaaaaaaaaaaaaaab"}}
 | 
|  |    426 | \only<3>{\code{"aaaaa...........aaaaaaaaaaaaaaaaaaaa"}}
 | 
|  |    427 | \only<4>{\code{"aaaaa...........aaaaaaaaaaaaaaaaaaaab"}}
 | 
|  |    428 | \only<5->{\code{"aaaaa...........aaaaaaaaaaaaaaaaaaaa"}}
 | 
|  |    429 | \end{center}
 | 
|  |    430 | 
 | 
|  |    431 | \only<6>{
 | 
|  |    432 | \begin{textblock}{13}(5,12)
 | 
|  |    433 | How long does Python need to find out?
 | 
|  |    434 | \end{textblock}}
 | 
|  |    435 | 
 | 
|  |    436 | \end{frame}
 | 
|  |    437 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
 | 
|  |    438 | 
 | 
|  |    439 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    440 | \begin{frame}<1>[c]
 | 
| 415 |    441 |   \frametitle{Main 3: Regexes}
 | 
| 68 |    442 |   
 | 
|  |    443 | \begin{center}
 | 
| 415 |    444 |   \mbox{Graphs: regex \alert{\texttt{(a*)*b}} and strings $\underbrace{\;\texttt{a}\ldots \texttt{a}\;}_{n}$}\bigskip
 | 
|  |    445 | 
 | 
|  |    446 | 
 | 
|  |    447 |   \small  
 | 
|  |    448 | \begin{tabular}[t]{@{\hspace{-8mm}}c@{\hspace{-0mm}}c@{}}
 | 
| 222 |    449 | \only<1>{\raisebox{6mm}{\begin{tikzpicture}
 | 
| 68 |    450 | \begin{axis}[
 | 
|  |    451 |     xlabel={$n$},
 | 
|  |    452 |     x label style={at={(1.05,0.0)}},
 | 
|  |    453 |     ylabel={time in secs},
 | 
|  |    454 |     enlargelimits=false,
 | 
|  |    455 |     xtick={0,5,...,30},
 | 
|  |    456 |     xmax=33,
 | 
|  |    457 |     ymax=35,
 | 
|  |    458 |     ytick={0,5,...,30},
 | 
|  |    459 |     scaled ticks=false,
 | 
|  |    460 |     axis lines=left,
 | 
|  |    461 |     width=5.5cm,
 | 
| 415 |    462 |     height=5cm,
 | 
|  |    463 |     legend entries={Java 8,Python,JavaScript,Swift,Dart},
 | 
|  |    464 |     %legend entries={\small{}Python,  \small{}Java 8,  \small{}JavaScript},  
 | 
| 68 |    465 |     legend pos=north west,
 | 
|  |    466 |     legend cell align=left]
 | 
|  |    467 | \addplot[blue,mark=*, mark options={fill=white}] table {re-python2.data};  
 | 
|  |    468 | \addplot[cyan,mark=*, mark options={fill=white}] table {re-java.data};
 | 
| 222 |    469 | \addplot[red,mark=*, mark options={fill=white}] table {re-js.data};
 | 
| 415 |    470 | \addplot[magenta,mark=*, mark options={fill=white}] table {re-swift.data};
 | 
|  |    471 | \addplot[brown,mark=*, mark options={fill=white}] table {re-dart.data};
 | 
| 68 |    472 | \end{axis}
 | 
| 222 |    473 | \end{tikzpicture}}}%
 | 
|  |    474 | \only<2>{\raisebox{0mm}{\begin{tikzpicture}
 | 
|  |    475 | \begin{axis}[
 | 
|  |    476 |     xlabel={$n$},
 | 
|  |    477 |     x label style={at={(1.05,0.0)}},
 | 
|  |    478 |     ylabel={time in secs},
 | 
|  |    479 |     %y label style={at={(0.06,0.5)}},
 | 
|  |    480 |     enlargelimits=false,
 | 
|  |    481 |     %xtick={0,30000,...,60000},
 | 
|  |    482 |     xmax=65000,
 | 
|  |    483 |     ymax=35,
 | 
|  |    484 |     ytick={0,5,...,30},
 | 
|  |    485 |     scaled ticks=true,
 | 
|  |    486 |     axis lines=left,
 | 
|  |    487 |     width=5.5cm,
 | 
|  |    488 |     height=5cm, 
 | 
|  |    489 |     legend entries={\small{}Java 9},  
 | 
|  |    490 |     legend pos=north west]
 | 
|  |    491 | \addplot[cyan,mark=*, mark options={fill=white}] table {re-java9.data};
 | 
|  |    492 | \end{axis}
 | 
|  |    493 | \end{tikzpicture}}}
 | 
| 68 |    494 |   &
 | 
| 222 |    495 | \onslide<1-2>{\begin{tikzpicture}
 | 
| 68 |    496 |   \begin{axis}[
 | 
|  |    497 |     xlabel={$n$},
 | 
|  |    498 |     x label style={at={(1.05,0.0)}},
 | 
|  |    499 |     ylabel={time in secs},
 | 
|  |    500 |     enlargelimits=false,
 | 
|  |    501 |     ymax=35,
 | 
|  |    502 |     ytick={0,5,...,30},
 | 
|  |    503 |     axis lines=left,
 | 
| 415 |    504 |     legend entries={You in M3}, 
 | 
| 68 |    505 |     %%scaled ticks=false,
 | 
|  |    506 |     width=5.5cm, 
 | 
|  |    507 |     height=5cm]
 | 
|  |    508 | %%\addplot[green,mark=square*,mark options={fill=white}] table {re2a.data};    
 | 
| 222 |    509 | \addplot[magenta,mark=square*,mark options={fill=white}] table {re3a.data};
 | 
| 68 |    510 | \end{axis}
 | 
| 70 |    511 | \end{tikzpicture}}
 | 
| 68 |    512 | \end{tabular}
 | 
|  |    513 | \end{center}
 | 
| 66 |    514 | 
 | 
| 68 |    515 | \hfill\small\url{https://vimeo.com/112065252}
 | 
| 66 |    516 | \end{frame}
 | 
| 325 |    517 | 
 | 
|  |    518 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
| 67 |    519 | 
 | 
| 415 |    520 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
 | 
|  |    521 | \begin{frame}[c,fragile]
 | 
|  |    522 | \small
 | 
|  |    523 | \textcolor{red}{MacOSX}\medskip
 | 
| 70 |    524 | 
 | 
| 415 |    525 | \begin{minipage}{13cm}
 | 
|  |    526 |   \begin{itemize}
 | 
|  |    527 |   \item[0)] (if needed) \texttt{brew install java} \;\;or\;\; \texttt{brew reinstall java}
 | 
|  |    528 |   \item[1)] \texttt{curl -s "https://get.sdkman.io" | bash}
 | 
|  |    529 |   \item[2)] \texttt{sdk install scala 2.13.7}  
 | 
|  |    530 |   \end{itemize}
 | 
|  |    531 | \end{minipage}\bigskip
 | 
|  |    532 |   
 | 
|  |    533 | \textcolor{red}{Windows / Linux Ubuntu}\medskip
 | 
|  |    534 | 
 | 
|  |    535 | \begin{minipage}{13cm}
 | 
|  |    536 |   \begin{itemize}
 | 
|  |    537 |   \item[0)] (if needed) \texttt{sudo apt-get remove scala-library scala}
 | 
|  |    538 |   \item[1)] {\fontsize{8.5}{8.5}\selectfont\texttt{sudo wget https://downloads.lightbend.com/scala/2.13.7/scala-2.13.7.deb}}
 | 
|  |    539 |   \item[2)] \texttt{sudo dpkg -i scala-2.13.7.deb}  
 | 
|  |    540 |   \end{itemize}
 | 
|  |    541 | \end{minipage}\bigskip
 | 
|  |    542 | 
 | 
|  |    543 | \begin{minipage}{13cm}
 | 
|  |    544 | other Linux distros: \texttt{sudo apt-get scala}
 | 
|  |    545 | \end{minipage}
 | 
|  |    546 | 
 | 
|  |    547 | \end{frame}
 | 
|  |    548 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
| 66 |    549 | 
 | 
|  |    550 | 
 | 
|  |    551 | \end{document}
 | 
|  |    552 | 
 | 
|  |    553 | %%% Local Variables:  
 | 
|  |    554 | %%% mode: latex
 | 
|  |    555 | %%% TeX-master: t
 | 
|  |    556 | %%% End: 
 | 
|  |    557 | 
 |