--- a/slides/slides01.tex Mon Sep 25 15:12:11 2023 +0100
+++ b/slides/slides01.tex Wed Sep 27 22:42:19 2023 +0100
@@ -5,6 +5,7 @@
\usepackage{../langs}
\usepackage{../data}
\usetikzlibrary{cd}
+\usepackage{listings-rust}
\usepackage{tcolorbox}
@@ -253,7 +254,7 @@
\begin{center}
\begin{tabular}{ll}
Email: & christian.urban at kcl.ac.uk\\
- Office Hour: & Fridays 11 -- 12\\
+ Office Hour: & Thurdays 15 -- 16\\
Location: & N7.07 (North Wing, Bush House)\\
Slides \& Progs: & KEATS\\
Pollev: & \texttt{\alert{https://pollev.com/cfltutoratki576}}\\
@@ -476,31 +477,31 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-{
-\setbeamercolor{background canvas}{bg=cream}
-\begin{frame}[c]
+% {
+% \setbeamercolor{background canvas}{bg=cream}
+% \begin{frame}[c]
-\frametitle{}
-\begin{mybox3}{}\it
- ``I enjoyed the module - it was genuinely the stand out academic
-experience of my undergraduate degree, and very much influenced my
-career interests. In fact I am currently working at ARM, in their Open
-Source Software group, on AArch64 specific optimisations for the
-Java/Kotlin compiler that forms part of the Android Runtime.''\\
-\mbox{}\hfill-- Hari Limaye in year 2021/22
-\end{mybox3}\pause
+% \frametitle{}
+% \begin{mybox3}{}\it
+% ``I enjoyed the module - it was genuinely the stand out academic
+% experience of my undergraduate degree, and very much influenced my
+% career interests. In fact I am currently working at ARM, in their Open
+% Source Software group, on AArch64 specific optimisations for the
+% Java/Kotlin compiler that forms part of the Android Runtime.''\\
+% \mbox{}\hfill-- Hari Limaye in year 2021/22
+% \end{mybox3}\pause
-Student numbers in CFL\medskip\\
-\begin{tabular}{ll}
-2019: & 32\\
-2020: & 59\\
-2021: & 109\\
-2022: & 121\\
-\end{tabular}
+% Student numbers in CFL\medskip\\
+% \begin{tabular}{ll}
+% 2019: & 32\\
+% 2020: & 59\\
+% 2021: & 109\\
+% 2022: & 121\\
+% \end{tabular}
-\end{frame}
-}
+% \end{frame}
+% }
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -637,7 +638,7 @@
\begin{frame}[c]
\frametitle{Some Housekeeping}
-\textbf{Exam will be online:}\bigskip
+\textbf{Exam will be computer-based, invigilated in some big examination hall:}\bigskip
\begin{itemize}
\item final exam in January (35\%)
@@ -655,12 +656,56 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+{\definecolor{rred}{HTML}{C0504D}
+\setbeamercolor{background canvas}{bg=cream}
+\begin{frame}[c]
+\frametitle{Students in CFL}
+
+\begin{center}
+\begin{tikzpicture}
+ \begin{axis}[symbolic x coords={2016,2017,2018,2019,2020,2021,2022,2023},
+ width = \textwidth,
+ height = 5cm,
+ bar width=8mm,
+ nodes near coords,
+ axis lines = left,
+ text=black,
+ ymin=0,
+ clip=false,
+ hide y axis,
+ axis line style={-},
+ name=mygraph
+ ]
+
+\addplot[ybar,style={rred,fill=rred!75,mark=none},text=black] coordinates {
+(2023,183)
+(2022,112)
+(2021,98)
+(2020,59)
+(2019,38)
+(2018,20)
+(2017,22)
+(2016,8)};
+\end{axis}
+\node[anchor=north, yshift=-10mm] at (mygraph.south) {\small{}Student numbers since the start of the compiler module.};
+
+\end{tikzpicture}
+\end{center}
+
+
+\end{frame}
+}
+
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
{
\setbeamercolor{background canvas}{bg=cream}
\begin{frame}[c]
\frametitle{Homework}
-Until 2 years ago: I did not give out solutions; students sent emails to me and I responded to them individually.\bigskip\\
+Until 2 years ago: I did not give out solutions; students
+sent emails to me and I responded to them individually.\bigskip\\
Since last year: We will review the homework mainly during the SGTs.\bigskip\\\pause
@@ -685,11 +730,58 @@
\item LLVM compiler (25\%)
\end{itemize}\bigskip\pause
-you can use \alert{any} programming language you like (Haskell, Rust)\\\pause
+you can use \alert{any} programming language you like (Haskell, Rust, Swift)\\\pause
you can use any code I show you and is uploaded to KEATS\ldots\textbf{BUT NOTHING ELSE!}
\end{frame}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+{
+\setbeamercolor{background canvas}{bg=cream}
+\begin{frame}[c,fragile]
+\frametitle{Ammonite \& Scala 3}
+
+I will show you all my code in Amm / Scala 3
+
+\begin{minipage}{1.4\textwidth}
+\begin{lstlisting}[language={},numbers=none,basicstyle=\ttfamily\small]
+$ amm
+Loading...
+Welcome to the Ammonite Repl 2.5.9 (Scala 3.2.2 Java 17.0.7)
+scala> 1 + 2
+res0: Int = 3
+\end{lstlisting} %% $
+\end{minipage}\medskip
+\pause
+
+Do not use Amm + Scala 2!
+
+\begin{minipage}{1.4\textwidth}
+\begin{lstlisting}[language={},numbers=none,basicstyle=\ttfamily\small]
+$ amm2
+Loading...
+Welcome to the Ammonite Repl 2.5.9 (Scala 2.13.11 Java 17.0.7)
+scala>
+\end{lstlisting} %% $
+\end{minipage}
+\end{frame}
+}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+{
+\setbeamercolor{background canvas}{bg=cream}
+\begin{frame}[c]
+\frametitle{For problems}
+
+\begin{itemize}
+\item Harry Dilnot
+\item Meilai
+\end{itemize}
+
+\end{frame}
+}
+
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[c]
@@ -991,6 +1083,126 @@
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+{
+\setbeamercolor{background canvas}{bg=cream}
+\begin{frame}[c]
+\frametitle{Rust vs.~Scala (from PEP)}
+
+\mbox{}
+
+\begin{minipage}{1.3\textwidth}
+\begin{mybox3}{}\it\small
+\textbf{Re: Another question of purely academic interest about regex implementation in cw3}
+
+This conversation is interesting to me, and I've researched it a
+little bit [...] I also disagree with Dr.~Urban on the cost/benefit of
+non-GC languages [...]\smallskip
+
+But regardless, Scala is a lot slower than, say, C or Rust. To say
+it's not is basically wrong (imo). Perhaps one could argue that some
+of the guarantees Scala has makes it easier to write multi-threaded
+programs that utilise more of the CPU... but, in my opinion, this is
+also a bit misleading. Most CPUs have something like 4 to 12 cores
+nowadays. It's very possible that a given Scala program runs 4-12x
+slower than its Rust equivalent. Would you rather have your program
+run quickly and use a single core, or have it run equally
+quickly... and... hog your entire CPU for its duration?\ldots{}
+
+\mbox{}\hfill-- Oliver Iliffe, discussion from PEP
+\end{mybox3}
+\end{minipage}
+
+\end{frame}
+}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+{
+\setbeamercolor{background canvas}{bg=cream}
+\begin{frame}[c]
+\frametitle{Regex Lib in Rust}
+
+\begin{center}
+\includegraphics[scale=0.34]{../pics/rust-regex.png}
+\end{center}
+
+\end{frame}
+}
+
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+{
+\setbeamercolor{background canvas}{bg=cream}
+\begin{frame}[c,fragile]
+
+\begin{columns}[t,onlytextwidth]
+\begin{column}{1\textwidth}
+\small re: \bl{$(abc)^{\{n\}}$}\quad str: \bl{$\underbrace{abc\ldots{}abc}_n$}\medskip\\
+\begin{tikzpicture}\footnotesize
+\begin{axis}[
+ xlabel={$n$},
+ x label style={at={(1.07,0.0)}},
+ ylabel={time in secs},
+ enlargelimits=false,
+ xmax=65000,
+ ymax=100,
+ xtick={0,15000,...,60000},
+ ytick={0,10,...,90},
+ scaled ticks=false,
+ axis lines=left,
+ width=7cm,
+ height=5cm]
+ \addplot[black,mark=square*,mark options={fill=red}] table [x=x, y=y, col sep=comma, row sep=crcr]
+ {x, y\\
+ 0, 0\\
+ 5000, 0.487\\
+ 10000, 1.650\\
+ 15000, 3.617\\
+ 20000, 6.462\\
+ 25000, 10.736\\
+ 30000, 17.665\\
+ 35000, 25.662\\
+ 40000, 36.422\\
+ 45000, 49.119\\
+ 50000, 62.058\\
+ 55000, 75.941\\
+ 60000, 93.022\\
+ };
+\end{axis}
+\end{tikzpicture}
+\end{column}
+\end{columns}
+
+\begin{textblock}{10}(8.4,3.8)
+\tiny
+\begin{lstlisting}[language=Rust]
+extern crate regex;
+
+use regex::Regex;
+use std::time::Instant;
+
+// bounded regular expression example
+
+fn main() {
+ for bound in (0..=60000).step_by(5000) {
+
+ let re = Regex::new(&format!("(abc){{{}}}", bound)).unwrap();
+ let text = "abc".repeat(bound);
+
+ let start_time = Instant::now();
+ let is_match = re.is_match(&text);
+ let elapsed_time = start_time.elapsed().as_secs_f64();
+
+ println!("Bound: {}, Match: {}, Time: {} seconds", bound, is_match, elapsed_time);
+ }
+}
+\end{lstlisting}
+\end{textblock}
+\end{frame}
+}
+
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\begin{frame}[c]
@@ -1512,6 +1724,29 @@
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+{
+\setbeamercolor{background canvas}{bg=cream}
+\begin{frame}[c]
+
+\begin{minipage}{1.3\textwidth}
+
+\end{minipage}
+\includegraphics[scale=0.4]{../pics/chatgpt.png}
+\end{frame}
+}
+
+{
+\setbeamercolor{background canvas}{bg=cream}
+\begin{frame}[c]
+\frametitle{\dots{}for amusement}
+
+\begin{minipage}{1.3\textwidth}
+\includegraphics[scale=0.4]{../pics/chatgpt1.png}
+\end{minipage}
+
+\end{frame}
+}
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%