% !TEX program = xelatex
\documentclass[dvipsnames,14pt,t,xelatex,aspectratio=169,xcolor={table}]{beamer}
\usepackage{../styles/slides}
\usepackage{../styles/mygraphs}
\usepackage{../styles/langs}
%%\usepackage{../data}
\usetikzlibrary{shapes}
\usepackage[export]{adjustbox}
\hfuzz=220pt
\usepackage{tcolorbox}
\newtcolorbox{mybox}{colback=red!5!white,colframe=red!75!black}
\newtcolorbox{mybox2}[1]{colback=red!5!white,colframe=red!75!black,fonttitle=\bfseries,title=#1}
\newtcolorbox{mybox3}[1]{colback=Cyan!5!white,colframe=Cyan!75!black,fonttitle=\bfseries,title=#1}
%\setmonofont[Scale=.88]{Consolas}
%\newfontfamily{\consolas}{Consolas}
\lstset{language=Scala,
style=mystyle,
numbersep=0pt,
numbers=none,
xleftmargin=0mm}
\newcommand{\bl}[1]{\textcolor{blue}{#1}}
% beamer stuff
\renewcommand{\slidecaption}{PEP (Scala) 03, King's College London}
\newcommand{\UParrow}[3]{%
\begin{textblock}{0}(#2,#3)%
\onslide<#1>{%
\begin{tikzpicture}%
\node at (0,0) [single arrow, shape border rotate=90, fill=red,text=red]{a};%
\end{tikzpicture}}%
\end{textblock}}
\newcommand{\DOWNarrow}[3]{%
\begin{textblock}{0}(#2,#3)%
\onslide<#1>{%
\begin{tikzpicture}%
\node at (0,0) [single arrow, shape border rotate=270, fill=red,text=red]{a};%
\end{tikzpicture}}%
\end{textblock}}
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[t]
\frametitle{%
\begin{tabular}{@ {}c@ {}}
\\[5mm]
\hspace{7mm}\huge PEP Scala (\liningnums{3})
\end{tabular}}
\normalsize
\begin{center}
\begin{tabular}{ll}
Email: & christian.urban at kcl.ac.uk\\
%Office: & N\liningnums{7.07} (North Wing, Bush House)\bigskip\\
Slides \& Code: & KEATS\bigskip\\
Office Hour: & Fridays 13:00 -- 14:00\\
Location: & N7.07 (North Wing, Bush House)\bigskip\\
Pollev: & \texttt{\alert{https://pollev.com/cfltutoratki576}}\\ \\
%Additionally: & (for Scala) Tuesdays 10:45 -- 11:45\\
\end{tabular}
\end{center}
%\tiny
%developed since 2004 bv Martin Odersky
%picture about assignments
\begin{textblock}{6}(0.5,0.5)
\includegraphics[scale=0.035]{../pics/assign.jpg}\\[-1mm]
\end{textblock}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \begin{frame}[c]
% \frametitle{Preliminary 6}
% Raw marks (261 submissions):\bigskip
% \begin{itemize}
% \item 3\%: \hspace{4mm}219
% \item 2\%: \hspace{4mm}19
% \item 1\%: \hspace{4mm}0
% \item 0\%: \hspace{4mm}23 \;(4 no submission)
% \end{itemize}
% \end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[c,fragile]
\frametitle{Default Arguments}
\small
\begin{lstlisting}[language=Scala, numbers=none, xleftmargin=-3mm]
def collatzHelper(n: Int, a: Int = 0) : Int = ...
collatzHelper(n, 3)
collatzHelper(n, 0)
collatzHelper(n) // a = 0
\end{lstlisting}
\DOWNarrow{1}{8.3}{3.4}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[c,fragile]
\frametitle{Last Week: Options \& HO Funs.}
\begin{lstlisting}[language=Scala, numbers=none, xleftmargin=-1mm]
List(7,2,3,4,5,6).find(_ < 4)
res: Option[Int] = Some(2)
List(5,6,7,8,9).find(_ < 4)
res: Option[Int] = None
List(1,2,3,4,5).map(x => x * x)
res: List[Int] = List(1, 4, 9, 16, 25)
\end{lstlisting}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[c,fragile]
\frametitle{Web-Crawler (1)}
\small
\begin{lstlisting}[language=Scala, numbers=none, xleftmargin=-7mm]
def get_page(url: String) : String = {
Try(fromURL(url)("ISO-8859-1").take(10000).mkString)
.getOrElse { println(s" Problem with: $url"); ""}
}
\end{lstlisting}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[c,fragile]
\frametitle{Web-Crawler (2)}
\small
\begin{lstlisting}[language=Scala, numbers=none,
xleftmargin=-7mm, escapeinside={(*@}{@*)}]
val http_pattern = """(*@\textcolor{codegreen}{"}@*)https?://[\^(*@\textcolor{codegreen}{"}@*)]*(*@\textcolor{codegreen}{"}@*)""".r
val email_pattern =
"""([a-z\d\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})""".r
def unquote(s: String) = s.drop(1).dropRight(1)
def get_all_URLs(page: String): Set[String] =
http_pattern.findAllIn(page).map(unquote).toSet
// returns all URLs in a page
\end{lstlisting}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[c,fragile]
\frametitle{Web-Crawler (3)}
\small
\begin{lstlisting}[language=Scala, numbers=none, xleftmargin=-1mm]
def crawl(url: String, n: Int) : Unit = {
if (n == 0) ()
else {
println(s" Visiting: $n $url")
val page = get_page(url)
for (u <- get_all_URLs(page))
crawl(u, n - 1)
}
}
\end{lstlisting}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[c,fragile]
\frametitle{Email Harvester}
\small
\begin{lstlisting}[language=Scala, numbers=none, xleftmargin=-3mm]
def emails(url: String, n: Int) : Set[String] = {
if (n == 0) Set()
else {
println(s" Visiting: $n $url")
val page = get_page(url)
val new_emails =
email_pattern.findAllIn(page).toSet
new_emails ++
(for (u <- get_all_URLs(page))
yield emails(u, n - 1)).flatten
}
}
\end{lstlisting}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[c]
\frametitle{Jumping Towers}
\begin{center}
\begin{tikzpicture}[scale=1.3]
\draw[line width=1mm,cap=round] (0,0) -- (5,0);
\draw[line width=1mm,cap=round] (0,1) -- (5,1);
\draw[line width=1mm,cap=round] (0,0) -- (0,1);
\node at (0.5,0.5) {\textbf{\Large 3}};
\draw[line width=1mm,cap=round] (1,0) -- (1,1);
\node at (1.5,0.5) {\textbf{\Large 4}};
\draw[line width=1mm,cap=round] (2,0) -- (2,1);
\node at (2.5,0.5) {\textbf{\Large 2}};
\draw[line width=1mm,cap=round] (3,0) -- (3,1);
\node at (3.5,0.5) {\textbf{\Large 0}};
\draw[line width=1mm,cap=round] (4,0) -- (4,1);
\node at (4.5,0.5) {\textbf{\Large 1}};
\draw[line width=1mm,cap=round] (5,0) -- (5,1);
\draw[->,line width=0.5mm,cap=round,out=90,in=90,relative] (0.5,1) to (1.5,1);
\draw[->,line width=0.5mm,cap=round,out=90,in=90,relative] (0.5,1) to (2.5,1);
\draw[->,line width=0.5mm,cap=round,out=90,in=90,relative] (0.5,1) to (3.5,1);
\draw[->,line width=0.5mm,cap=round,out=-90,in=-90,relative] (2.5,0) to (3.5,0);
\draw[->,line width=0.5mm,cap=round,out=-90,in=-90,relative] (2.5,0) to (4.5,0);
\draw[->,line width=0.5mm,cap=round,out=90,in=90,relative] (4.5,1) to (5.7,1);
\node at (5.7, 0.8) {End};
\end{tikzpicture}
\end{center}\bigskip
shortest: 3 $\rightarrow$ 4 $\rightarrow$ End
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[c]
\frametitle{next moves}
\begin{center}
\begin{tikzpicture}
[grow=right,level distance=30mm,child anchor=north,line width=0.5mm]
\node {$[3,4,2,0,1]$}
child {node {$[0,1]$}}
child {node {$[2,0,1]$}
child {node {$[1]$} child [level distance=13mm] {node {End}}}
child {node {$[0,1]$}}
}
child {node {$[4,2,0,1]$\ldots}};
\end{tikzpicture}
\end{center}
\begin{textblock}{4}(13,12)
\includegraphics[scale=0.06]{../pics/chess.jpg}
\end{textblock}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[c,fragile]
\frametitle{Reverse Polish Notation}
{\Large\bl{$(3 + 1) * (2 + 9)$}}\bigskip
{\Large$\Rightarrow$}\bigskip
{\;\;\Large\bl{$3\;\;1\;+\;2\;\;9\;+\;*$}}
\begin{textblock}{3}(11,4)
\begin{onlyenv}<2>
\begin{lstlisting}[language=JVMIS]
ldc 3
ldc 1
iadd
ldc 2
ldc 9
iadd
imul
\end{lstlisting}
\end{onlyenv}
\end{textblock}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \begin{frame}[c,fragile]
% \frametitle{Sudoku}
% 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}
% \end{frame}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \begin{frame}[t]
% \begin{center}
% \includegraphics[scale=0.3]{../pics/blow.png}
% \end{center}
% \begin{textblock}{14}(2,11.4)
% \large\bf{}Mind-Blowing Programming Languages:\\
% \centering JavaScript
% \end{textblock}
% \end{frame}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\begin{frame}[t]
%\frametitle{Preliminary 1 (Scala)}
%
%Raw marks (298 submissions):\bigskip
%
%\begin{itemize}
%\item 3\%: \hspace{4mm}227
%\item 2\%: \hspace{4mm}35
%\item 1\%: \hspace{4mm}9
%\item 0\%: \hspace{4mm}27
%\end{itemize}
%
%
%\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\begin{frame}[t]
%\frametitle{Preliminary 2 (Scala)}
%
%Raw marks (301 submissions):\bigskip%
%
%\begin{itemize}
%\item 3.0\%: \hspace{4mm}236
%\item 2.5\%: \hspace{4mm}5
%\item 2.0\%: \hspace{4mm}7
%\item 1.5\%: \hspace{4mm}13
%\item 1.0\%: \hspace{4mm}1
%\item 0.5\%: \hspace{4mm}2
%\item 0.0\%: \hspace{4mm}37
%\end{itemize}
%
%
%\end{frame}
%
%\begin{frame}<1-20>
%\end{frame}
\begin{frame}<1-10>[t]
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[t,fragile]
\frametitle{\mbox{}\hspace{40mm}\textbf{Testing Server}}
\begin{textblock}{5}(2,6)
\includegraphics[scale=0.35]{../pics/commits.png}
\end{textblock}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
{
\setbeamercolor{background canvas}{bg=cream}
\begin{frame}[c]
\frametitle{\mbox{}\hspace{40mm}\textbf{Feedback in
\textcolor{red}{\underline{CFL}!}}}
\begin{minipage}{1.3\textwidth}
\begin{mybox3}{End-of-year feedback for 6CCS3CFL in 2019}\it\small
Unequivocally the worst module I've taken on this course. The subject
matter is fascinating, however the insistence on the use of this
abomination of a language "Scala" completely ruins it. If you're going
to teach something as complex as this, use a proper language, not some
"object oriented functional" abomination. Use C, you know, the
language that real compilers are written in. I will go to the end of
the earth to dissuade others from taking this module so long as Scala
is still being used.\\
\mbox{}\hfill-- Lone voice in the end-of-year feedback in 2019
\end{mybox3}
\end{minipage}\bigskip
\end{frame}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
{\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}
\begin{textblock}{5}(12, 2.5)
\includegraphics[scale=0.15]{../pics/cfl.png}\\
\hspace{5mm}2021
\end{textblock}
\begin{textblock}{5}(12, 9)
\includegraphics[scale=0.15]{../pics/cfl2021.png}\\
\hspace{5mm}2022
\end{textblock}
\end{frame}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
{
\setbeamercolor{background canvas}{bg=cream}
\begin{frame}[c]
\mbox{}\\[-4mm]
\begin{minipage}{1.3\textwidth}
\begin{mybox3}{One comment from this year}\it\small
I feel like the module's point is to help us experience what it is
like to program very challenging problems, it's not very realistic
as in a realistic scenario we would have access to the internet, and
other people's code and may collaborate. I feel like the point of
the module is taken away due to how the plagiarism and collusion
rules are put into place.
\end{mybox3}
\end{minipage}\smallskip
\begin{minipage}{1.3\textwidth}
\begin{mybox3}{Another comment from this year}\it\small
To prepare students for the C++ coursework better, for example introducing recursion and/or backtracking, because that is a big part of the coursework but wasn't even touched upon in the videos
\end{mybox3}
\end{minipage}\smallskip
\begin{minipage}{1.3\textwidth}
\begin{mybox3}{Even another comment from this year}\it\small
The coursework is too difficult.
\end{mybox3}
\end{minipage}
\end{frame}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
{
\setbeamercolor{background canvas}{bg=cream}
\begin{frame}[c]
\begin{itemize}
\item we reduced the amount of work this year and gave more time for C++ CW
\item we recruited TA's for\bigskip
installation problems:
\begin{itemize}
\item Oscar Sjostedt (\texttt{\small{}oscar.sjostedt@kcl.ac.uk})
\item Nicole Lehchevska (\texttt{\small{}nicole.lehchevska@kcl.ac.uk})\bigskip
\end{itemize}
github problems:
\begin{itemize}
\item Quan Tran (\texttt{\small{}anh.tran@kcl.ac.uk})\bigskip
\end{itemize}
discussion forum / general problems:
\begin{itemize}
\item Ruben Ticehurst-James (\texttt{\small{}ruben.ticehurst-james@kcl.ac.uk})
\end{itemize}
\end{itemize}
\only<2->{
\begin{textblock}{7}(9, 8)
\textcolor{red}{\Large\bf Could you
please spend the next 10 mins to fill
out the end-of-year feedback.}
\includegraphics[scale=0.035]{thanks.png}
\end{textblock}}
\end{frame}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{document}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End: