slides/slides04.tex
changeset 418 fa7f7144f2bb
parent 416 497f67fd4ae0
child 449 d67c5f7177a6
--- a/slides/slides04.tex	Tue Dec 07 01:35:00 2021 +0000
+++ b/slides/slides04.tex	Tue Dec 07 23:17:51 2021 +0000
@@ -39,6 +39,35 @@
 % beamer stuff 
 \renewcommand{\slidecaption}{PEP (Scala) 04, King's College London}
 
+% Swift, example (a*)*b  
+\begin{filecontents}{re-swift.data}
+5   0.001
+10  0.001
+15  0.009
+20  0.178
+23  1.399
+24  2.893
+25  5.671
+26  11.357
+27  22.430
+\end{filecontents}
+
+% Dart, example (a*)*b  
+\begin{filecontents}{re-dart.data}
+20 0.042
+21 0.084
+22 0.190
+23 0.340
+24 0.678
+25 1.369
+26 2.700
+27 5.462
+28 10.908
+29 21.725
+30 43.492
+\end{filecontents}
+
+
 \begin{filecontents}{re3a.data}
 1 0.00003
 500001 0.22527
@@ -150,7 +179,8 @@
     Slides \& Code: & KEATS\bigskip\\
     %Office Hours: &  Thursdays 12:00 -- 14:00\\
     %Additionally: & (for Scala) Tuesdays 10:45 -- 11:45\\
-    \multicolumn{2}{c}{\Large\textbf{https://pollev.com/cfltutoratki576}}\\
+    \multicolumn{2}{c}{\Large\textbf{https://pollev.com/cfltutoratki576}}\\[2cm]
+    \textcolor{red}{Scala Install Clinic:} & \textcolor{red}{This evening at 17:00 (online)}\\
   \end{tabular}
   \end{center}
 
@@ -185,104 +215,104 @@
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
-\begin{frame}[c]
-\frametitle{Preliminary 7}
+% \begin{frame}[c]
+% \frametitle{Preliminary 7}
 
-Raw marks (261 submissions):\bigskip
+% Raw marks (261 submissions):\bigskip
 
-\begin{itemize}
-\item 4\%: \hspace{4mm}236
-\item 3\%: \hspace{4mm}10
-\item 2\%: \hspace{4mm}1
-\item 1\%: \hspace{4mm}0
-\item 0\%: \hspace{4mm}15 
-\end{itemize}\bigskip\bigskip  
+% \begin{itemize}
+% \item 4\%: \hspace{4mm}236
+% \item 3\%: \hspace{4mm}10
+% \item 2\%: \hspace{4mm}1
+% \item 1\%: \hspace{4mm}0
+% \item 0\%: \hspace{4mm}15 
+% \end{itemize}\bigskip\bigskip  
 
-\footnotesize
-(plagiarism/collusion interviews ongoing!)
+% \footnotesize
+% (plagiarism/collusion interviews ongoing!)
 
-\end{frame}
+% \end{frame}
 
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\begin{frame}[c,fragile]
-\small
+% \begin{frame}[c,fragile]
+% \small
   
-\begin{lstlisting}[language=Scala, numbers=none, xleftmargin=1mm]
-def is_legal(dim: Int, p: Path, x: Pos) = {
-  if (...some_really_long_condition...) false
-  else true
-}
-\end{lstlisting}
+% \begin{lstlisting}[language=Scala, numbers=none, xleftmargin=1mm]
+% def is_legal(dim: Int, p: Path, x: Pos) = {
+%   if (...some_really_long_condition...) false
+%   else true
+% }
+% \end{lstlisting}
 
-\pause
-\bigskip
-\rule{11cm}{0.3mm}
-\bigskip
+% \pause
+% \bigskip
+% \rule{11cm}{0.3mm}
+% \bigskip
 
-\begin{lstlisting}[language=Scala, numbers=none, xleftmargin=1mm]
-def is_legal(dim: Int, p: Path, x: Pos) = 
-  !(...some_really_long_condition...)
-\end{lstlisting}
+% \begin{lstlisting}[language=Scala, numbers=none, xleftmargin=1mm]
+% def is_legal(dim: Int, p: Path, x: Pos) = 
+%   !(...some_really_long_condition...)
+% \end{lstlisting}
 
-\end{frame}
+% \end{frame}
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\begin{frame}[c,fragile]
-\small
+% \begin{frame}[c,fragile]
+% \small
   
-\begin{lstlisting}[language=Scala, numbers=none, xleftmargin=1mm]
-def foobar(...) = {
-  val cs = for (c <- str) yield c.toLowerCase
-  ...
-}
-\end{lstlisting}
+% \begin{lstlisting}[language=Scala, numbers=none, xleftmargin=1mm]
+% def foobar(...) = {
+%   val cs = for (c <- str) yield c.toLowerCase
+%   ...
+% }
+% \end{lstlisting}
 
-\pause
-\bigskip
-\rule{11cm}{0.3mm}
-\bigskip
+% \pause
+% \bigskip
+% \rule{11cm}{0.3mm}
+% \bigskip
 
-\begin{lstlisting}[language=Scala, numbers=none, xleftmargin=1mm]
-def foobar(...) = {
-  val cs = str.map(_.toLowerCase)
-  ...
-}
-\end{lstlisting}
+% \begin{lstlisting}[language=Scala, numbers=none, xleftmargin=1mm]
+% def foobar(...) = {
+%   val cs = str.map(_.toLowerCase)
+%   ...
+% }
+% \end{lstlisting}
 
-\end{frame}
+% \end{frame}
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
 
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\begin{frame}[c,fragile]
-\small
+% \begin{frame}[c,fragile]
+% \small
   
-\begin{lstlisting}[language=Scala, numbers=none, xleftmargin=-7mm]
-def RomanNumeral2Int(rs: RomanNumeral): Int = 
- rs match { 
-   case Nil => 0
-   case M::r    => 1000 + RomanNumeral2Int(r)  
-   case C::M::r => 900 + RomanNumeral2Int(r)
-   case D::r    => 500 + RomanNumeral2Int(r)
-   case C::D::r => 400 + RomanNumeral2Int(r)
-   case C::r    => 100 + RomanNumeral2Int(r)
-   case X::C::r => 90 + RomanNumeral2Int(r)
-   case L::r    => 50 + RomanNumeral2Int(r)
-   case X::L::r => 40 + RomanNumeral2Int(r)
-   case X::r    => 10 + RomanNumeral2Int(r)
-   case I::X::r => 9 + RomanNumeral2Int(r)
-   case V::r    => 5 + RomanNumeral2Int(r)
-   case I::V::r => 4 + RomanNumeral2Int(r)
-   case I::r    => 1 + RomanNumeral2Int(r)
- }
-\end{lstlisting}
+% \begin{lstlisting}[language=Scala, numbers=none, xleftmargin=-7mm]
+% def RomanNumeral2Int(rs: RomanNumeral): Int = 
+%  rs match { 
+%    case Nil => 0
+%    case M::r    => 1000 + RomanNumeral2Int(r)  
+%    case C::M::r => 900 + RomanNumeral2Int(r)
+%    case D::r    => 500 + RomanNumeral2Int(r)
+%    case C::D::r => 400 + RomanNumeral2Int(r)
+%    case C::r    => 100 + RomanNumeral2Int(r)
+%    case X::C::r => 90 + RomanNumeral2Int(r)
+%    case L::r    => 50 + RomanNumeral2Int(r)
+%    case X::L::r => 40 + RomanNumeral2Int(r)
+%    case X::r    => 10 + RomanNumeral2Int(r)
+%    case I::X::r => 9 + RomanNumeral2Int(r)
+%    case V::r    => 5 + RomanNumeral2Int(r)
+%    case I::V::r => 4 + RomanNumeral2Int(r)
+%    case I::r    => 1 + RomanNumeral2Int(r)
+%  }
+% \end{lstlisting}
 
-\end{frame}
+% \end{frame}
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -331,34 +361,34 @@
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
-\begin{frame}[c,fragile]
-\frametitle{Sudoku}
+% \begin{frame}[c,fragile]
+% \frametitle{Sudoku}
 
-A very simple-minded version on 110 problems:\bigskip
+% A very simple-minded version on 110 problems:\bigskip
 
-\begin{itemize}
-\item 1 core: 800 secs
-\item 2 cores: 400 secs
-\item 8 cores: 290 secs
-\item 18 cores: 142 secs
-\end{itemize}
+% \begin{itemize}
+% \item 1 core: 800 secs
+% \item 2 cores: 400 secs
+% \item 8 cores: 290 secs
+% \item 18 cores: 142 secs
+% \end{itemize}
 
-\end{frame}
+% \end{frame}
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  
 
 
-\begin{frame}[t]
+% \begin{frame}[t]
 
-  \begin{center}  
-  \includegraphics[scale=0.3]{../pics/blow.png}
-  \end{center}
+%   \begin{center}  
+%   \includegraphics[scale=0.3]{../pics/blow.png}
+%   \end{center}
   
-  \begin{textblock}{14}(2,11.4)
-  \large\bf{}Mind-Blowing Regular Expressions:\\ 
-  \centering in Python, JavaScript, Java
-  \end{textblock}
-\end{frame}
+%   \begin{textblock}{14}(2,11.4)
+%   \large\bf{}Mind-Blowing Regular Expressions:\\ 
+%   \centering in Python, JavaScript, Java
+%   \end{textblock}
+% \end{frame}
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -387,12 +417,14 @@
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \begin{frame}<1>[c]
-  \frametitle{CW 9: Regexes}
+  \frametitle{Main 3: Regexes}
   
 \begin{center}
-  Graphs: \alert{\texttt{(a*)*b}} and strings $\underbrace{\;\texttt{a}\ldots \texttt{a}\;}_{n}$\bigskip
-  
-\begin{tabular}[t]{@{\hspace{-8mm}}c@{\hspace{-4mm}}c@{}}
+  \mbox{Graphs: regex \alert{\texttt{(a*)*b}} and strings $\underbrace{\;\texttt{a}\ldots \texttt{a}\;}_{n}$}\bigskip
+
+
+  \small  
+\begin{tabular}[t]{@{\hspace{-8mm}}c@{\hspace{-0mm}}c@{}}
 \only<1>{\raisebox{6mm}{\begin{tikzpicture}
 \begin{axis}[
     xlabel={$n$},
@@ -406,13 +438,16 @@
     scaled ticks=false,
     axis lines=left,
     width=5.5cm,
-    height=5cm, 
-    legend entries={\small{}Python,  \small{}Java 8,  \small{}JavaScript},  
+    height=5cm,
+    legend entries={Java 8,Python,JavaScript,Swift,Dart},
+    %legend entries={\small{}Python,  \small{}Java 8,  \small{}JavaScript},  
     legend pos=north west,
     legend cell align=left]
 \addplot[blue,mark=*, mark options={fill=white}] table {re-python2.data};  
 \addplot[cyan,mark=*, mark options={fill=white}] table {re-java.data};
 \addplot[red,mark=*, mark options={fill=white}] table {re-js.data};
+\addplot[magenta,mark=*, mark options={fill=white}] table {re-swift.data};
+\addplot[brown,mark=*, mark options={fill=white}] table {re-dart.data};
 \end{axis}
 \end{tikzpicture}}}%
 \only<2>{\raisebox{0mm}{\begin{tikzpicture}
@@ -445,6 +480,7 @@
     ymax=35,
     ytick={0,5,...,30},
     axis lines=left,
+    legend entries={You in M3}, 
     %%scaled ticks=false,
     width=5.5cm, 
     height=5cm]
@@ -460,7 +496,35 @@
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
+\begin{frame}[c,fragile]
+\small
+\textcolor{red}{MacOSX}\medskip
 
+\begin{minipage}{13cm}
+  \begin{itemize}
+  \item[0)] (if needed) \texttt{brew install java} \;\;or\;\; \texttt{brew reinstall java}
+  \item[1)] \texttt{curl -s "https://get.sdkman.io" | bash}
+  \item[2)] \texttt{sdk install scala 2.13.7}  
+  \end{itemize}
+\end{minipage}\bigskip
+  
+\textcolor{red}{Windows / Linux Ubuntu}\medskip
+
+\begin{minipage}{13cm}
+  \begin{itemize}
+  \item[0)] (if needed) \texttt{sudo apt-get remove scala-library scala}
+  \item[1)] {\fontsize{8.5}{8.5}\selectfont\texttt{sudo wget https://downloads.lightbend.com/scala/2.13.7/scala-2.13.7.deb}}
+  \item[2)] \texttt{sudo dpkg -i scala-2.13.7.deb}  
+  \end{itemize}
+\end{minipage}\bigskip
+
+\begin{minipage}{13cm}
+other Linux distros: \texttt{sudo apt-get scala}
+\end{minipage}
+
+\end{frame}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 
 \end{document}