308
+ − 1
% !TEX program = xelatex
352
+ − 2
\documentclass[dvipsnames,14pt,t,xelatex,aspectratio=169,xcolor={table}]{beamer}
442
+ − 3
\usepackage{../styles/slides}
+ − 4
\usepackage{../styles/mygraphs}
+ − 5
\usepackage{../styles/langs}
22
+ − 6
%\usepackage{../data}
442
+ − 7
\usetikzlibrary{shapes}
22
+ − 8
442
+ − 9
\hfuzz=220pt
22
+ − 10
+ − 11
%\setmonofont[Scale=.88]{Consolas}
+ − 12
%\newfontfamily{\consolas}{Consolas}
+ − 13
+ − 14
\lstset{language=Scala,
+ − 15
style=mystyle,
+ − 16
numbersep=0pt,
+ − 17
numbers=none,
+ − 18
xleftmargin=0mm}
+ − 19
353
+ − 20
+ − 21
\colorlet{punct}{red!60!black}
+ − 22
\definecolor{background}{HTML}{EEEEEE}
+ − 23
\definecolor{delim}{RGB}{20,105,176}
+ − 24
\colorlet{numb}{magenta!60!black}
+ − 25
+ − 26
\lstdefinelanguage{json}{
+ − 27
basicstyle=\normalfont\ttfamily,
+ − 28
numbers=left,
+ − 29
numberstyle=\scriptsize,
+ − 30
stepnumber=1,
+ − 31
%numbersep=8pt,
+ − 32
showstringspaces=false,
+ − 33
breaklines=true,
+ − 34
%frame=lines,
+ − 35
%backgroundcolor=\color{background},
+ − 36
literate=
+ − 37
*{0}{{{\color{numb}0}}}{1}
+ − 38
{1}{{{\color{numb}1}}}{1}
+ − 39
{2}{{{\color{numb}2}}}{1}
+ − 40
{3}{{{\color{numb}3}}}{1}
+ − 41
{4}{{{\color{numb}4}}}{1}
+ − 42
{5}{{{\color{numb}5}}}{1}
+ − 43
{6}{{{\color{numb}6}}}{1}
+ − 44
{7}{{{\color{numb}7}}}{1}
+ − 45
{8}{{{\color{numb}8}}}{1}
+ − 46
{9}{{{\color{numb}9}}}{1}
+ − 47
{:}{{{\color{punct}{:}}}}{1}
+ − 48
{,}{{{\color{punct}{,}}}}{1}
+ − 49
{\{}{{{\color{delim}{\{}}}}{1}
+ − 50
{\}}{{{\color{delim}{\}}}}}{1}
+ − 51
{[}{{{\color{delim}{[}}}}{1}
+ − 52
{]}{{{\color{delim}{]}}}}{1},
+ − 53
}
+ − 54
309
+ − 55
\newcommand{\bl}[1]{\textcolor{blue}{#1}}
+ − 56
+ − 57
\newcommand{\RIGHTarrow}[3]{%
+ − 58
\begin{textblock}{0}(#2,#3)%
+ − 59
\onslide<#1>{%
+ − 60
\begin{tikzpicture}%
+ − 61
\node at (0,0) [single arrow, shape border rotate=0, fill=red,text=red]{a};%
+ − 62
\end{tikzpicture}}%
+ − 63
\end{textblock}}
+ − 64
\newcommand{\LEFTarrow}[3]{%
+ − 65
\begin{textblock}{0}(#2,#3)%
+ − 66
\onslide<#1>{%
+ − 67
\begin{tikzpicture}%
+ − 68
\node at (0,0) [single arrow, shape border rotate=180, fill=red,text=red]{a};%
+ − 69
\end{tikzpicture}}%
+ − 70
\end{textblock}}
+ − 71
\newcommand{\DOWNarrow}[3]{%
+ − 72
\begin{textblock}{0}(#2,#3)%
+ − 73
\onslide<#1>{%
+ − 74
\begin{tikzpicture}%
+ − 75
\node at (0,0) [single arrow, shape border rotate=270, fill=red,text=red]{a};%
+ − 76
\end{tikzpicture}}%
+ − 77
\end{textblock}}
22
+ − 78
+ − 79
% beamer stuff
195
+ − 80
\renewcommand{\slidecaption}{PEP (Scala) \liningnums{01}, King's College London}
22
+ − 81
334
+ − 82
% https://insights.stackoverflow.com/survey/2019#technology-most-loved-dreaded-and-wanted
+ − 83
+ − 84
% processors in the future / Ahmdahl law
+ − 85
% https://www.youtube.com/watch?v=_9mzmvhwMqw
+ − 86
352
+ − 87
\setbeamertemplate{itemize items}{$\bullet$}
+ − 88
\setbeamertemplate{itemize subitem}{$\bullet$}
+ − 89
\setbeamertemplate{itemize subsubitem}{$\bullet$}
+ − 90
+ − 91
\usepackage{tcolorbox}
+ − 92
\newtcolorbox{mybox}{colback=red!5!white,colframe=red!75!black}
+ − 93
\newtcolorbox{mybox2}[1]{colback=red!5!white,colframe=red!75!black,fonttitle=\bfseries,title=#1}
+ − 94
\newtcolorbox{mybox3}[1]{colback=Cyan!5!white,colframe=Cyan!75!black,fonttitle=\bfseries,title=#1}
22
+ − 95
+ − 96
\begin{document}
+ − 97
+ − 98
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − 99
\begin{frame}[t]
+ − 100
\frametitle{%
+ − 101
\begin{tabular}{@ {}c@ {}}
+ − 102
\\[5mm]
199
+ − 103
\hspace{7mm}\huge PEP Scala (\liningnums{1})
22
+ − 104
\end{tabular}}
+ − 105
+ − 106
\normalsize
+ − 107
\begin{center}
+ − 108
\begin{tabular}{ll}
137
+ − 109
Email: & christian.urban at kcl.ac.uk\\
353
+ − 110
%Office: & N\liningnums{7.07} (North Wing, Bush House)\bigskip\\
309
+ − 111
Slides \& Code: & KEATS\bigskip\\
442
+ − 112
477
+ − 113
Office Hour: & Fridays 13:00 -- 14:00\\
442
+ − 114
Location: & N7.07 (North Wing, Bush House)\bigskip\\
+ − 115
+ − 116
Pollev: & \texttt{\alert{https://pollev.com/cfltutoratki576}}\\ \\
353
+ − 117
%Additionally: & (for Scala) Tuesdays 10:45 -- 11:45\\
22
+ − 118
\end{tabular}
+ − 119
\end{center}
+ − 120
199
+ − 121
%\tiny
+ − 122
%developed since 2004 bv Martin Odersky
+ − 123
%picture about assignments
+ − 124
+ − 125
\begin{textblock}{6}(0.5,0.5)
+ − 126
\includegraphics[scale=0.035]{../pics/assign.jpg}\\[-1mm]
+ − 127
\end{textblock}
22
+ − 128
+ − 129
\end{frame}
+ − 130
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − 131
+ − 132
+ − 133
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − 134
\begin{frame}[c]
+ − 135
\frametitle{Why Scala?}
+ − 136
352
+ − 137
\begin{textblock}{6}(3,3)
22
+ − 138
\begin{tabular}{l}
442
+ − 139
%%\mbox{}\hspace{-1mm}\includegraphics[scale=0.36]{../pics/twitter.png}\\[-1mm]
22
+ − 140
\includegraphics[scale=0.30]{../pics/linked.png}\\
141
+ − 141
\includegraphics[scale=0.30]{../pics/guardian.jpg}\\[-3mm]
22
+ − 142
\mbox{}\hspace{-2mm}\includegraphics[scale=0.38]{../pics/morgan.png}\\[-3mm]
+ − 143
\includegraphics[scale=0.30]{../pics/suisse.png}\\
477
+ − 144
Standard \& Poor's\\
23
+ − 145
{\large\bf ...}
+ − 146
\end{tabular}
+ − 147
\end{textblock}
+ − 148
477
+ − 149
\begin{textblock}{6}(8,3)
23
+ − 150
\begin{tabular}{l}
22
+ − 151
\includegraphics[scale=0.20]{../pics/edf.png}\\[-1mm]
+ − 152
\includegraphics[scale=0.08]{../pics/novell.png}\\[-1mm]
+ − 153
\includegraphics[scale=0.30]{../pics/foursquare.png}\\
+ − 154
\includegraphics[scale=0.30]{../pics/hsbc.png}\\
+ − 155
{\large\bf ...}
+ − 156
\end{tabular}
+ − 157
\end{textblock}
+ − 158
477
+ − 159
\begin{textblock}{6}(11,3)
481
+ − 160
\begin{tabular}{c}
477
+ − 161
\includegraphics[scale=0.08]{../pics/lichess.png}\\[-1mm]
481
+ − 162
{\footnotesize lichess engine (open source)}\\[-2mm]
+ − 163
{\footnotesize \url{lichess.org}}\\
477
+ − 164
\end{tabular}
+ − 165
\end{textblock}
+ − 166
199
+ − 167
352
+ − 168
\begin{textblock}{12}(2,11)
+ − 169
\footnotesize
+ − 170
\begin{mybox3}{A former student working now at Quantexa:}\it
+ − 171
``I am a former student. I graduated last year. I got my dream job
+ − 172
as a backend Scala developer. Most of the Scala I know is from PEP
+ − 173
2018/19. My interviewers said they expect code of a lesser quality
+ − 174
even from people with one year of experience.''
+ − 175
\end{mybox3}
+ − 176
\end{textblock}
199
+ − 177
22
+ − 178
\end{frame}
443
+ − 179
22
+ − 180
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
443
+ − 181
\begin{frame}[c]
22
+ − 182
443
+ − 183
\begin{textblock}{12}(2,2)
+ − 184
\small
+ − 185
\begin{mybox3}{}\it
+ − 186
``I am currently working as a software engineer at Morgan Stanley
+ − 187
whilst doing my year-in-industry and am using Scala in the
+ − 188
workplace. My team were impressed that I could already program in the
+ − 189
language and even had knowledge of other functional languages. They
+ − 190
told me that most university students are not taught such languages.''
+ − 191
\smallskip\newline
+ − 192
\mbox{}\hfill{}-- Sumaiya Mohbubul 2021/22
+ − 193
\end{mybox3}
+ − 194
\end{textblock}
+ − 195
+ − 196
\begin{textblock}{12}(2,9)
+ − 197
\small
+ − 198
\begin{mybox3}{}\it
+ − 199
``PEP was my favourite module so far during these 2 years. It motivated
+ − 200
me to apply and get a summer internship offer at S\&P Global as a Scala
+ − 201
developer. The module content was more than enough for me to start
+ − 202
working on the projects here at the company.''\smallskip\newline
+ − 203
\mbox{}\hfill{}-- Szabolcs Nagy 2021/22
+ − 204
\end{mybox3}
+ − 205
\end{textblock}
+ − 206
+ − 207
\end{frame}
+ − 208
+ − 209
+ − 210
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
352
+ − 211
%\begin{textblock}{6}(2,12)
+ − 212
%\begin{bubble}[9.4cm]
+ − 213
% \small
+ − 214
% developed since 2004 by Martin Odersky
+ − 215
% (he was behind Generic Java which was included in Java 5
+ − 216
% \ldots I am using Scala since maybe 2008?)
+ − 217
%\end{bubble}
+ − 218
%\end{textblock}
23
+ − 219
+ − 220
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − 221
\begin{frame}[c]
+ − 222
\frametitle{Why Scala?}
+ − 223
+ − 224
\begin{itemize}
34
+ − 225
\item compiles to the JVM\\
+ − 226
\textcolor{gray}{(also JavaScript, native X86 in the works)}\medskip
32
+ − 227
\item integrates seamlessly with Java\medskip
352
+ − 228
\item combines \underline{\bf functional} and {\bf object-oriented} programming\medskip
+ − 229
+ − 230
\item no pointers, no null
+ − 231
%\item it is a bit on the ``theory'' / ``mathematical'' side\\
+ − 232
% \textcolor{gray}{(no pointers, no \texttt{null}, but expressions)}
34
+ − 233
33
+ − 234
\item often one can write very concise and elegant code
+ − 235
\end{itemize}\bigskip\medskip
+ − 236
308
+ − 237
%\small
+ − 238
%alternatives:\\
+ − 239
%Elm, Haskell, Ocaml, F$\sharp$, Erlang, ML, Lisp (Racket), \ldots
23
+ − 240
+ − 241
\end{frame}
22
+ − 242
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
23
+ − 243
+ − 244
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
308
+ − 245
\begin{frame}[t]
32
+ − 246
\frametitle{Java vs Scala}
+ − 247
308
+ − 248
{\lstset{language=java,numbers=right}\fontsize{12}{12}\selectfont
32
+ − 249
\texttt{\lstinputlisting{Point.java}}}
+ − 250
308
+ − 251
\rule{11cm}{0.3mm}\\[-3mm]
33
+ − 252
32
+ − 253
{\lstset{language=scala}\fontsize{12}{12}\selectfont
+ − 254
\texttt{\lstinputlisting{Point.scala}}}
+ − 255
+ − 256
\begin{textblock}{6}(13,3)
+ − 257
\textbf{\large Java}
33
+ − 258
\end{textblock}
+ − 259
308
+ − 260
\begin{textblock}{6}(13,14.3)
32
+ − 261
\textbf{\large Scala}
+ − 262
\end{textblock}
+ − 263
+ − 264
\end{frame}
+ − 265
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − 266
174
+ − 267
+ − 268
+ − 269
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − 270
\begin{frame}[c]
477
+ − 271
\frametitle{First Steps: \textcolor{red}{Scala 3} Tools}
32
+ − 272
477
+ − 273
\mbox{}\\
+ − 274
+ − 275
\begin{minipage}{1.1\textwidth}
33
+ − 276
\begin{itemize}
477
+ − 277
\item contains a REPL $\Rightarrow$ but this year we use
+ − 278
\textcolor{red}{\texttt{scala-cli}}
+ − 279
\item I use VS Codium and a Scala extension (M'place)
199
+ − 280
\begin{center}
+ − 281
\includegraphics[scale=0.10]{../pics/vscode.png}\\[-10mm]\mbox{}
+ − 282
\end{center}\bigskip
+ − 283
481
+ − 284
\item there is also a plugin for IntelliJ, but I do not recommend it\medskip
477
+ − 285
\end{itemize}
+ − 286
\end{minipage}
33
+ − 287
+ − 288
\end{frame}
137
+ − 289
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − 290
+ − 291
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
353
+ − 292
\begin{frame}[c, fragile]
+ − 293
+ − 294
\small
+ − 295
My personal keboard shortcut for VS Code\\
+ − 296
(in keybindings.json)\bigskip
+ − 297
360
+ − 298
\footnotesize
+ − 299
\begin{lstlisting}[language=json,numbers=none,xrightmargin=-4cm]
353
+ − 300
[
+ − 301
{
+ − 302
"key": "ctrl+enter",
+ − 303
"command": "workbench.action.terminal.runSelectedText",
+ − 304
"when": "editorTextFocus && editorHasSelection"
+ − 305
}
+ − 306
]
+ − 307
\end{lstlisting}
+ − 308
+ − 309
+ − 310
\end{frame}
+ − 311
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − 312
477
+ − 313
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − 314
\begin{frame}[c, fragile]
+ − 315
\frametitle{This year Scala 3/ \textbf{\texttt{scala-cli}}}
+ − 316
+ − 317
\mbox{}\\
+ − 318
+ − 319
\begin{minipage}{1.3\textwidth}
+ − 320
\begin{center}
+ − 321
\textbf{\texttt{scala-cli}}
+ − 322
$\quad\Rightarrow$ {\small\url{https://scala-cli.virtuslab.org/}}\bigskip
+ − 323
\end{center}
+ − 324
+ − 325
Installation problems:
+ − 326
\begin{itemize}
+ − 327
\item Oscar Sjostedt (\texttt{\small{}oscar.sjostedt@kcl.ac.uk})
+ − 328
\item Nicole Lehchevska (\texttt{\small{}nicole.lehchevska@kcl.ac.uk})\bigskip
+ − 329
\end{itemize}
+ − 330
Github problems:
+ − 331
\begin{itemize}
+ − 332
\item Quan Tran (\texttt{\small{}anh.tran@kcl.ac.uk})\bigskip
+ − 333
\end{itemize}
+ − 334
Discussion forum:
+ − 335
\begin{itemize}
+ − 336
\item Ruben Ticehurst-James (\texttt{\small{}ruben.ticehurst-james@kcl.ac.uk})
+ − 337
\end{itemize}
+ − 338
\end{minipage}
+ − 339
+ − 340
\end{frame}
+ − 341
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − 342
+ − 343
+ − 344
353
+ − 345
+ − 346
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
309
+ − 347
\begin{frame}[t]
+ − 348
\frametitle{Why Scala?}
+ − 349
477
+ − 350
\only<2-4>{%
309
+ − 351
\begin{center}
+ − 352
{\large\bf{}Money?}\bigskip\\
+ − 353
\begin{tabular}{@{}c@{}c@{}}
+ − 354
\includegraphics[scale=0.2]{../pics/salary1.png} &
+ − 355
\includegraphics[scale=0.2]{../pics/salary2.png}\\
+ − 356
\multicolumn{2}{r@{}}{\footnotesize$^*$ source: Stackoverflow Developer Survey, 2019}
+ − 357
\end{tabular}
+ − 358
\end{center}
353
+ − 359
\RIGHTarrow{2}{2.0}{6.3}
314
+ − 360
\DOWNarrow{2}{10.1}{4.4}
309
+ − 361
+ − 362
\small
+ − 363
Elm, Rust, Haskell, Ocaml, F$\#$, Erlang, ML, Lisp (Racket)\ldots
477
+ − 364
}
309
+ − 365
+ − 366
\only<3>{
477
+ − 367
\begin{textblock}{2}(7.5,6.7)
+ − 368
\includegraphics[scale=0.2]{../pics/salary3.png}
+ − 369
\end{textblock}
+ − 370
\RIGHTarrow{2}{2.0}{6.3}
+ − 371
\DOWNarrow{2}{10.1}{4.4}}
+ − 372
+ − 373
+ − 374
\only<4>{
309
+ − 375
\begin{textblock}{6}(3.3,6.2)
+ − 376
\begin{bubble}[6.5cm]
+ − 377
\bf\huge\textcolor{RoyalBlue}{Functional Programming!}
+ − 378
\end{bubble}
+ − 379
\end{textblock}}
+ − 380
477
+ − 381
+ − 382
309
+ − 383
\end{frame}
+ − 384
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − 385
+ − 386
+ − 387
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
137
+ − 388
\begin{frame}[c]
309
+ − 389
\frametitle{\begin{tabular}{c}\\[2mm]
+ − 390
Why Functional\\[-2mm] Programming?\end{tabular}
137
+ − 391
}
+ − 392
+ − 393
%
+ − 394
\mbox{}\\[3.5cm]
+ − 395
\small
309
+ − 396
Elm, Haskell, Ocaml, F$\#$, Erlang, ML, Lisp (Racket)\ldots
137
+ − 397
309
+ − 398
\only<2>{
477
+ − 399
\begin{textblock}{8}(1.3,6.2)
+ − 400
\begin{bubble}[12cm]
+ − 401
\normalsize\it``If you want to see which features will be in mainstream programming
137
+ − 402
languages tomorrow, then take a look at functional programming
+ − 403
languages today.''\medskip\small\\
477
+ − 404
\hfill{}---Simon Peyton Jones (works at Epic Games, used to work at Microsoft)\\
137
+ − 405
\hfill{}main developer of the Glasgow Haskell Compiler
+ − 406
\end{bubble}
+ − 407
\end{textblock}}
+ − 408
309
+ − 409
\only<3>{
200
+ − 410
\begin{textblock}{6}(5,5.8)
+ − 411
\hspace{2mm}\includegraphics[scale=0.06]{../pics/assign.jpg}\\[-1mm]
309
+ − 412
\Large\alert{\hspace{5mm}\textbf{Immutability}}
200
+ − 413
\end{textblock}}
+ − 414
+ − 415
137
+ − 416
\end{frame}
+ − 417
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − 418
200
+ − 419
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
309
+ − 420
\begin{frame}[c]
+ − 421
+ − 422
\begin{center}
+ − 423
\includegraphics[scale=0.4]{../pics/pure.png}
+ − 424
\end{center}
+ − 425
+ − 426
\begin{textblock}{6}(9,14)
+ − 427
\tiny$^*$ from ``What pure functional programming is all about?''
+ − 428
\end{textblock}
+ − 429
\end{frame}
+ − 430
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − 431
+ − 432
+ − 433
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
200
+ − 434
\begin{frame}[c, fragile]
+ − 435
+ − 436
{\Large Why bother? or\smallskip\\\hfill What is wrong with this?}\bigskip\bigskip
+ − 437
+ − 438
+ − 439
\begin{lstlisting}[language=C,numbers=none]
+ − 440
for (int i = 10; i < 20; i++) {
+ − 441
+ − 442
//...Do something interesting
+ − 443
// with i...
+ − 444
+ − 445
}
+ − 446
\end{lstlisting}
+ − 447
+ − 448
+ − 449
\end{frame}
+ − 450
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − 451
+ − 452
+ − 453
137
+ − 454
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − 455
\begin{frame}[c]
+ − 456
\mbox{}\\[-21mm]\mbox{}
+ − 457
+ − 458
\begin{center}
+ − 459
\begin{tikzpicture}[scale=1,
+ − 460
node/.style={
+ − 461
rectangle,rounded corners=3mm,
+ − 462
very thick,draw=black!50,
+ − 463
minimum height=18mm, minimum width=20mm,
+ − 464
top color=white,bottom color=black!20}]
+ − 465
+ − 466
\onslide<1-10>{
+ − 467
\node (A) at (0,0) [node]
+ − 468
{\mbox{\includegraphics[scale=0.15]{../pics/cplus2.jpg}}};
+ − 469
\node [above right] at (A.north west) {1986};}
+ − 470
+ − 471
\onslide<2->{
+ − 472
\node (B) at (3.5,0) [node]
+ − 473
{\mbox{\includegraphics[scale=0.15]{../pics/robotron.jpg}}};
+ − 474
\node [above right] at (B.north west) {1988, C};
+ − 475
\draw [->,line width=4mm] (A) -- (B);}
+ − 476
+ − 477
\onslide<3->{
+ − 478
\node (C0) at (6.3,0) {};
+ − 479
\node (C) at (8,0) [node]
+ − 480
{\mbox{\includegraphics[scale=0.15]{../pics/sun.jpg}}};
+ − 481
\node [above right] at (C.north west) {1992, {\small Linux}};
+ − 482
\draw [->,line width=4mm] (B) -- (C0);
+ − 483
\draw [->,line width=4mm] (C0) -- (C);}
+ − 484
+ − 485
\onslide<4->{
+ − 486
\node (D) at (8,-3.3) [node]
+ − 487
{\mbox{\includegraphics[scale=0.2]{../pics/gateway.jpg}}};
+ − 488
\draw [->,line width=4mm] (C) -- (D);
+ − 489
\node [below right] at (D.south west) {1996};}
+ − 490
+ − 491
\onslide<5->{
+ − 492
\node (E) at (4,-3.3) [node]
+ − 493
{\mbox{\includegraphics[scale=0.1]{../pics/appleg4.jpg}}};
+ − 494
\draw [->,line width=4mm] (D) -- (E);
+ − 495
\node [above right] at (E.north west) {2000};}
+ − 496
+ − 497
\onslide<6->{
+ − 498
\node (F0) at (1.5,-3.3) {};
+ − 499
\node (F1) at (1,-3.3) {};
+ − 500
\node (F) at (-0.9,-3.3) [node]
+ − 501
{\mbox{\includegraphics[scale=0.3]{../pics/appleair.png}}};
+ − 502
\draw [->,line width=4mm] (E) -- (F0);
+ − 503
\draw [->,line width=4mm] (F1) -- (F);
+ − 504
\node [above right] at (F.north west) {2012?};}
+ − 505
+ − 506
\onslide<7->{
+ − 507
\node (G) at (-0.9,-6.3) [node]
+ − 508
{\mbox{\includegraphics[scale=0.02]{../pics/applepro.jpg}}};
+ − 509
\draw [->,line width=4mm] (F) -- (G);
+ − 510
\node [right] at (G.west) {\hspace{22mm}2017};}
+ − 511
+ − 512
\end{tikzpicture}
+ − 513
\end{center}
+ − 514
+ − 515
+ − 516
\only<1>{%
+ − 517
\begin{textblock}{10}(2.5,5)
+ − 518
\includegraphics[scale=0.26]{../pics/cplus1.jpg}\\
+ − 519
\footnotesize 64K RAM, no HD, no monitor, lots of cables
+ − 520
\end{textblock}
+ − 521
\begin{textblock}{6}(10.9,4.5)
+ − 522
\includegraphics[scale=0.09]{../pics/mand1.png}
+ − 523
\includegraphics[scale=0.09]{../pics/mand2.png}
+ − 524
\end{textblock}
+ − 525
\begin{textblock}{6}(10.8,2.2)
+ − 526
\huge\bf 3 days
+ − 527
\end{textblock}
+ − 528
}
+ − 529
\only<8->{%
+ − 530
\begin{textblock}{8}(5.8,11.6)
+ − 531
\large\bf
+ − 532
\begin{tabular}{l@{}l}
+ − 533
1986:\, & no Internet\\
+ − 534
& no Amazon\\
+ − 535
& no FB, no mobiles,\ldots\\
+ − 536
\end{tabular}
+ − 537
\end{textblock}
+ − 538
}
+ − 539
\only<9>{
+ − 540
\begin{textblock}{1}(3,3)
+ − 541
\begin{bubble}[9cm]
+ − 542
\begin{tabular}{@{\hspace{8mm}}llll@{\hspace{8mm}}}
+ − 543
\\
200
+ − 544
\multicolumn{4}{c}{\alert{\bf Speedup by Moore's Law}}\medskip\\
137
+ − 545
\textbf{1986:} & 3 days & \textbf{1996:} & 135 mins\\
+ − 546
\textbf{1988:} & 1.5 days & \textbf{1998:} & 67 mins\\
+ − 547
\textbf{1990:} & 18 hs & \textbf{2000:} & 33 mins\\
+ − 548
\textbf{1992:} & 9 hs & \textbf{2002:} & 16 mins\\
+ − 549
\textbf{1994:} & 4.5 hs & \multicolumn{2}{c}{???}\\
+ − 550
\\
+ − 551
\end{tabular}
+ − 552
\small Every two years, computers got twice as powerful.
+ − 553
\end{bubble}
+ − 554
\end{textblock}}
+ − 555
+ − 556
\end{frame}
+ − 557
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − 558
+ − 559
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − 560
\begin{frame}[c]
200
+ − 561
\frametitle{Seq \;vs\; Par}
137
+ − 562
+ − 563
\begin{center}
+ − 564
\begin{tabular}[t]{@{}l@{}l@{}}
200
+ − 565
\includegraphics[scale=0.14]{../pics/mand4.png} & \hspace{4mm}
+ − 566
\raisebox{0mm}{\includegraphics[scale=0.14]{../pics/mand3.png}}\\
+ − 567
\hspace{6mm}\includegraphics[scale=0.5]{../pics/cpu2.png} &
+ − 568
\hspace{11mm}\includegraphics[scale=0.5]{../pics/cpu1.png}
137
+ − 569
\end{tabular}
+ − 570
\end{center}
+ − 571
+ − 572
\only<2>{
+ − 573
\begin{textblock}{5}(12,2)
+ − 574
\begin{bubble}[2.1cm]
+ − 575
\footnotesize{}in Java or C++\\
+ − 576
\includegraphics[scale=0.50]{../pics/skeleton.jpg}\\
+ − 577
\end{bubble}
+ − 578
\end{textblock}}
+ − 579
+ − 580
\only<3>{
200
+ − 581
\begin{textblock}{14.2}(1,13.5)
140
+ − 582
In FP: Once a variable is created, it is assigned a value and then
308
+ − 583
never changed again $\Rightarrow$ no synchronisation needed\smallskip\\
200
+ − 584
%%\small\textcolor{gray}{(Andrew's second favourite feature of C++)}
137
+ − 585
\end{textblock}}
+ − 586
+ − 587
\end{frame}
+ − 588
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − 589
354
+ − 590
%\begin{frame}
+ − 591
%
+ − 592
%\end{frame}
137
+ − 593
354
+ − 594
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − 595
%\begin{frame}[c, fragile]
+ − 596
%
+ − 597
%\mbox{}\bigskip\bigskip\bigskip
+ − 598
%
+ − 599
%\begin{lstlisting}[language=Scala,numbers=none]
+ − 600
%for (y <- (0 until H).par) {
+ − 601
% for (x <- (0 until W).par) {
+ − 602
%
+ − 603
% ...
+ − 604
%
+ − 605
% }
+ − 606
%}
+ − 607
%\end{lstlisting}
+ − 608
%
+ − 609
%
+ − 610
%\end{frame}
+ − 611
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
32
+ − 612
+ − 613
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − 614
\begin{frame}[c]
23
+ − 615
\frametitle{Types}
+ − 616
+ − 617
\begin{itemize}
33
+ − 618
\item Base types\smallskip
23
+ − 619
33
+ − 620
\begin{tabular}{@{}l@{}}
23
+ − 621
\textcolor{codegreen}{\texttt{Int}},
+ − 622
\textcolor{codegreen}{\texttt{Long}},
+ − 623
\textcolor{codegreen}{\texttt{BigInt}},
+ − 624
\textcolor{codegreen}{\texttt{Float}},
+ − 625
\textcolor{codegreen}{\texttt{Double}}\\
+ − 626
\textcolor{codegreen}{\texttt{String}},
25
+ − 627
\textcolor{codegreen}{\texttt{Char}}\\
+ − 628
\textcolor{codegreen}{\texttt{Boolean}}
23
+ − 629
\end{tabular}
+ − 630
33
+ − 631
\item Compound types \smallskip
23
+ − 632
33
+ − 633
\begin{tabular}{@{}ll@{}}
23
+ − 634
\textcolor{codegreen}{\texttt{List[Int]}} & lists of Int's \\
+ − 635
\textcolor{codegreen}{\texttt{Set[Double]}} & sets of Double's \\
+ − 636
\textcolor{codegreen}{\texttt{(Int, String)}} & Int-String pair\\
+ − 637
\textcolor{codegreen}{\texttt{List[(BigInt, String)]}} &
+ − 638
lists of BigInt-String\\
+ − 639
& pairs\\
200
+ − 640
\textcolor{codegreen}{\texttt{List[List[Int]]}} & list of lists of Int's\\ \textcolor{codegreen}{\texttt{Option[Int]}} & options of Int's \\
23
+ − 641
\end{tabular}
+ − 642
+ − 643
\end{itemize}
+ − 644
+ − 645
\end{frame}
+ − 646
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − 647
32
+ − 648
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
200
+ − 649
%\begin{frame}[c]
+ − 650
%\frametitle{An Http Request}
32
+ − 651
200
+ − 652
%\begin{textblock}{1}(2,5)
+ − 653
%\begin{tabular}{c}
+ − 654
%\includegraphics[scale=0.15]{../pics/servers.png}\\[-2mm]
+ − 655
%\small Server
+ − 656
%\end{tabular}
+ − 657
%\end{textblock}
32
+ − 658
200
+ − 659
%\begin{textblock}{1}(5.6,4)
+ − 660
% \begin{tikzpicture}[scale=1.1]
+ − 661
% \draw[white] (0,1) node (X) {};
+ − 662
% \draw[white] (2,1) node (Y) {};
+ − 663
% \draw[white] (0,0) node (X1) {};
+ − 664
% \draw[white] (2,0) node (Y1) {};
+ − 665
% \draw[white] (0,-1) node (X2) {};
+ − 666
% \draw[white] (2,-1) node (Y2) {};
+ − 667
% \draw[red, <-, line width = 2mm] (X) -- (Y);
+ − 668
% \node [inner sep=5pt,label=above:\textcolor{black}{GET request}] at ($ (X)!.5!(Y) $) {};
+ − 669
% \draw[red, ->, line width = 2mm] (X1) -- (Y1);
+ − 670
% \node [inner sep=5pt,label=above:\textcolor{black}{webpage}] at ($ (X1)!.5!(Y1) $) {};
+ − 671
% \draw[red, <-, line width = 2mm] (X2) -- (Y2);
+ − 672
% \node [inner sep=7pt,label=above:\textcolor{black}{POST data}] at ($ (X2)!.5!(Y2) $) {};
+ − 673
% \end{tikzpicture}
+ − 674
%\end{textblock}
32
+ − 675
+ − 676
200
+ − 677
%\begin{textblock}{1}(9,5.5)
+ − 678
%\begin{tabular}{c}
+ − 679
%\includegraphics[scale=0.15]{../pics/laptop.png}\\[-2mm]
+ − 680
%\small Browser
+ − 681
%\end{tabular}
+ − 682
%\end{textblock}
+ − 683
%\end{frame}
32
+ − 684
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − 685
+ − 686
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
200
+ − 687
%\begin{frame}[c]
+ − 688
%
+ − 689
%{\lstset{language=Java}\fontsize{7}{8}\selectfont
+ − 690
%\texttt{\lstinputlisting{URLReader.java}}}
+ − 691
%
+ − 692
%\end{frame}
32
+ − 693
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − 694
33
+ − 695
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
356
+ − 696
\begin{frame}[c, fragile]
359
+ − 697
%%\frametitle{General Scheme of}
356
+ − 698
358
+ − 699
\small
+ − 700
\begin{lstlisting}[language=Scala,numbers=none]
+ − 701
def fname(arg1: ty1, arg2: ty2,..., argn: tyn): rty = {
356
+ − 702
358
+ − 703
....
356
+ − 704
+ − 705
}
+ − 706
\end{lstlisting}
+ − 707
+ − 708
+ − 709
\end{frame}
+ − 710
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − 711
359
+ − 712
\begin{frame}[c, fragile]
+ − 713
+ − 714
\begin{lstlisting}[language=Scala,numbers=none]
+ − 715
def average(xs: List[Int]) : Int = {
+ − 716
val s = xs.sum
+ − 717
val n = xs.length
+ − 718
s / n
+ − 719
}
+ − 720
\end{lstlisting}
+ − 721
+ − 722
+ − 723
\end{frame}
+ − 724
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − 725
+ − 726
+ − 727
+ − 728
309
+ − 729
356
+ − 730
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − 731
%\begin{frame}[c]
+ − 732
% \frametitle{Coursework Dates}
+ − 733
%
+ − 734
%Similar to C++:\bigskip
+ − 735
%
+ − 736
%\begin{itemize}
+ − 737
% \item Preliminary Parts: Wednesdays 4pm
+ − 738
% \begin{itemize}
+ − 739
% \item Preliminary Part 6: 3\% (13 November)
+ − 740
% \item Preliminary Part 7: 4\% (20 November)
+ − 741
% \item Preliminary Part 8: 4\% (27 November)
+ − 742
% \item Preliminary Part 9: 4\% (5 December)
+ − 743
% \end{itemize}\medskip
+ − 744
% \item Core Part: 35\% (15 January 2020)\bigskip
+ − 745
%\end{itemize}
+ − 746
%\end{frame}
+ − 747
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
309
+ − 748
+ − 749
+ − 750
+ − 751
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
356
+ − 752
%\begin{frame}[c]
+ − 753
%\frametitle{Coursework}
+ − 754
%
+ − 755
%\begin{itemize}
+ − 756
%\item Sorry, I might have been a bit wordy:\\
+ − 757
% Part 6 of CW description is 7 pages, but
+ − 758
% I only needed \mbox{< 100} loc for \emph{all} Part 6.\bigskip
+ − 759
%
+ − 760
%\item there is feedback when pushing code to github\medskip
+ − 761
%
+ − 762
%\item there are \texttt{jar}-files you can use to test
+ − 763
% my reference implementation\bigskip
+ − 764
%
+ − 765
%\item we want you to learn FP!\smallskip\\ \alert{\bf no vars}, no mutable
+ − 766
% data-structures\\ \quad{}e.g.~no \texttt{Arrays}, no \texttt{ListBuffer}
+ − 767
%\end{itemize}
+ − 768
%
+ − 769
%\LEFTarrow{1}{11}{11.8}
+ − 770
%\end{frame}
140
+ − 771
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − 772
+ − 773
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − 774
+ − 775
\begin{frame}[c, fragile]
+ − 776
\frametitle{The Joy of Immutability}
+ − 777
+ − 778
\begin{itemize}
+ − 779
\item If you need to manipulate some data in a list say, then you make
+ − 780
a new list with the updated values, rather than revise the original
+ − 781
list. Easy!\medskip
+ − 782
+ − 783
{\small
+ − 784
\begin{lstlisting}[language=Scala, numbers=none, xleftmargin=-1mm]
+ − 785
val old_list = List(1, 2, 3, 5)
+ − 786
val new_list = 0 :: old_list
308
+ − 787
// -> List(0, 1, 2, 3, 4, 5)
140
+ − 788
\end{lstlisting}}
+ − 789
200
+ − 790
\item You do not have to be defensive about who can access the data.
+ − 791
+ − 792
\item You can look at your code in isolation.
140
+ − 793
\end{itemize}
+ − 794
\end{frame}
+ − 795
+ − 796
+ − 797
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − 798
+ − 799
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − 800
\begin{frame}[t]
+ − 801
\frametitle{Email: Hate 'val'}
+ − 802
308
+ − 803
\mbox{}\\[-23mm]\mbox{}
140
+ − 804
+ − 805
\begin{center}
+ − 806
\begin{bubble}[10.5cm]
354
+ − 807
Subject: \textbf{Hate '\textbf{\texttt{val}}'}\hfill 01:00 AM\hspace{1cm}\medskip\\
140
+ − 808
+ − 809
Hello Mr Urban,\medskip\\
+ − 810
+ − 811
I just wanted to ask, how are we suppose to work
+ − 812
with the completely useless \textbf{\texttt{val}}, that can’t be changed ever? Why is
+ − 813
this rule active at all? I’ve spent 4 hours not thinking on the
+ − 814
coursework, but how to bypass this annoying rule. What’s the whole
+ − 815
point of all these coursework, when we can’t use everything Scala
+ − 816
gives us?!?\medskip\\
+ − 817
+ − 818
Regards.\\
+ − 819
\mbox{}\hspace{5mm}\textcolor{black!50}{<<deleted>>}\\
+ − 820
\end{bubble}
+ − 821
\end{center}
+ − 822
+ − 823
\end{frame}
+ − 824
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − 825
+ − 826
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − 827
\begin{frame}[c]
+ − 828
+ − 829
\mbox{}\\[-25mm]\mbox{}
+ − 830
+ − 831
\begin{center}
+ − 832
\begin{bubble}[10.5cm]
354
+ − 833
Subject: \textbf{Re: Hate '\textbf{\texttt{val}}'}\hfill 01:02 AM\hspace{1cm}\bigskip\bigskip\\
140
+ − 834
+ − 835
\textcolor{black!70}{
+ − 836
\textit{\large<<my usual rant about fp\ldots\\ concurrency bla bla\ldots{} better programs
+ − 837
yada>>}}\bigskip\bigskip\bigskip
+ − 838
+ − 839
PS: What are you trying to do where you desperately want to use \texttt{var}?
+ − 840
\end{bubble}
+ − 841
\end{center}
+ − 842
+ − 843
\end{frame}
+ − 844
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − 845
+ − 846
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − 847
\begin{frame}[c,fragile]
+ − 848
+ − 849
\begin{textblock}{6}(0.5,0.5)
+ − 850
\begin{bubble}[11.5cm]
+ − 851
\small
354
+ − 852
Subject: \textbf{Re: Re: Hate '\textbf{\texttt{val}}'}\hfill 01:04 AM\hspace{1cm}\medskip\\
140
+ − 853
+ − 854
\textbf{Right now my is\_legal function works fine:}
+ − 855
+ − 856
\footnotesize\begin{lstlisting}[language=Scala, numbers=none, xleftmargin=-1mm]
+ − 857
def is_legal(dim: Int, path: Path)(x: Pos): Boolean = {
+ − 858
var boolReturn = false
+ − 859
if(x._1 > dim || x._2 > dim || x._1 < 0 || x._2 < 0) {
+ − 860
else { var breakLoop = false
+ − 861
if(path == Nil) { boolReturn = true }
+ − 862
else { for(i <- 0 until path.length) {
+ − 863
if(breakLoop == false) {
+ − 864
if(path(i) == x) {
+ − 865
boolReturn = true
+ − 866
breakLoop = true
+ − 867
}
+ − 868
else { boolReturn = false }
+ − 869
} else breakLoop
+ − 870
}
+ − 871
}
+ − 872
boolReturn
+ − 873
}
+ − 874
\end{lstlisting}
+ − 875
\end{bubble}
+ − 876
\end{textblock}
+ − 877
+ − 878
\begin{textblock}{6}(8.2,11.8)
+ − 879
\begin{bubble}[5.5cm]\footnotesize\bf
+ − 880
\ldots{}but I can’t make it work with boolReturn being val. What approach would
+ − 881
you recommend in this case, and is using var in this case justified?
+ − 882
\end{bubble}
+ − 883
\end{textblock}
+ − 884
+ − 885
\only<2>{
+ − 886
\begin{textblock}{6}(0.3,11.8)
+ − 887
\begin{bubble}[3.1cm]
+ − 888
\textbf{Me:}
+ − 889
\raisebox{-12mm}{\includegraphics[scale=0.08]{../pics/throwup.jpg}}
+ − 890
\end{bubble}
+ − 891
\end{textblock}}
+ − 892
+ − 893
\end{frame}
+ − 894
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − 895
+ − 896
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − 897
\begin{frame}[t,fragile]
+ − 898
+ − 899
\mbox{}\\[-25mm]\mbox{}
+ − 900
+ − 901
\begin{textblock}{6}(0.5,2)
+ − 902
\begin{bubble}[11.5cm]
+ − 903
Subject: \textbf{Re: Re: Re: Hate '\textbf{\texttt{val}}'}\hfill 01:06 AM\bigskip\\
+ − 904
\small
+ − 905
+ − 906
OK. So you want to make sure that the \texttt{x}-position is not outside the
+ − 907
board....and furthermore you want to make sure that the \texttt{x}-position
+ − 908
is not yet in the path list. How about something like\bigskip
+ − 909
+ − 910
\footnotesize\begin{lstlisting}[language=Scala, numbers=none, xleftmargin=-1mm]
+ − 911
def is_legal(dim: Int, path: Path)(x: Pos): Boolean =
+ − 912
...<<some board conditions>>... && !path.contains(x)
+ − 913
\end{lstlisting}\bigskip
+ − 914
+ − 915
\small Does not even contain a \texttt{val}.
+ − 916
\end{bubble}
+ − 917
\end{textblock}
+ − 918
+ − 919
\begin{textblock}{6}(7,12)
+ − 920
\footnotesize\textcolor{black!50}{(This is all on one line)}
+ − 921
\end{textblock}
+ − 922
+ − 923
\end{frame}
+ − 924
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − 925
+ − 926
+ − 927
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − 928
\begin{frame}[t,fragile]
+ − 929
+ − 930
\mbox{}\\[-15mm]\mbox{}
+ − 931
+ − 932
\begin{textblock}{6}(1,3)
+ − 933
\begin{bubble}[10.5cm]
+ − 934
Subject: \textbf{Re: Re: Re: Re: Hate '\textbf{\texttt{val}}'}\hfill 11:02 AM\bigskip\bigskip\\
+ − 935
+ − 936
THANK YOU! You made me change my coding perspective. Because of you,
+ − 937
I figured out the next one\ldots
+ − 938
\end{bubble}
+ − 939
\end{textblock}
+ − 940
+ − 941
\only<2>{
+ − 942
\begin{textblock}{6}(0.3,11.8)
+ − 943
\begin{bubble}[3.1cm]
+ − 944
\textbf{Me:}
+ − 945
\raisebox{-12mm}{\includegraphics[scale=0.15]{../pics/happy.jpg}}
+ − 946
\end{bubble}
+ − 947
\end{textblock}}
+ − 948
+ − 949
\end{frame}
+ − 950
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − 951
427
+ − 952
\begin{frame}[t,fragile]
+ − 953
+ − 954
\begin{bubble}[10.5cm]
477
+ − 955
\it "PEP was my favourite module so far during these 2 years. It motivated me to apply and get a summer internship offer at S\&P Global as a Scala developer. The module content was more than enough for me to start working on the projects here at the company."\\
+ − 956
\mbox{}\hfill{}--- Szabolcs Daniel Nagi (PEP 2021)
427
+ − 957
\end{bubble}
+ − 958
\end{frame}
+ − 959
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − 960
140
+ − 961
+ − 962
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − 963
\begin{frame}[c]
309
+ − 964
\frametitle{Conclusion for Today}
33
+ − 965
+ − 966
\begin{itemize}
477
+ − 967
\item This year we will be using Scala 3 with the \texttt{scala-cli} REPL!\\
+ − 968
\medskip
+ − 969
\item {\bf\url{https://scala-cli.virtuslab.org/}}\bigskip
140
+ − 970
477
+ − 971
\item Scala can be a rather \textbf{\alert{deep}} language\ldots i.e.~gives
+ − 972
you a lot of rope to shoot yourself.\bigskip
33
+ − 973
477
+ − 974
\item Learning functional programming is not easy\ldots{}when you have
200
+ − 975
spent all of your career thinking in an imperative way, it is hard to
477
+ − 976
change.\bigskip\medskip
140
+ − 977
477
+ − 978
\item Hope you have fun with Scala and the assignments.
33
+ − 979
\end{itemize}
+ − 980
\end{frame}
+ − 981
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − 982
+ − 983
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
356
+ − 984
%\begin{frame}[c]
+ − 985
%\frametitle{\begin{tabular}{c}\\[0cm]\alert{Questions?}\end{tabular}}
+ − 986
%
+ − 987
%\begin{center}
+ − 988
% \begin{tabular}[t]{@{}l@{}l@{}}
+ − 989
% \includegraphics[scale=0.1]{../pics/mand4.png} & \hspace{4mm}
+ − 990
% \raisebox{0mm}{\includegraphics[scale=0.1]{../pics/mand3.png}}
+ − 991
% \end{tabular}
+ − 992
%\end{center}
+ − 993
%
+ − 994
%\begin{center}
+ − 995
% My Office Hours: Thursdays 12 -- 14\\
+ − 996
% And specifically for Scala: Tuesdays 10:45 -- 11:45
+ − 997
%\end{center}
+ − 998
%\end{frame}
33
+ − 999
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
314
+ − 1000
+ − 1001
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
356
+ − 1002
%\begin{frame}[t]%
+ − 1003
%
+ − 1004
%\begin{center}
+ − 1005
%\includegraphics[scale=0.4]{../pics/blow.png}
+ − 1006
%\end{center}
+ − 1007
%
+ − 1008
%\begin{textblock}{14}(2,12.4)
+ − 1009
%\Large\bf{}Mind-Blowing\\ Programming Languages: C/C++
+ − 1010
%\end{textblock}
+ − 1011
%\end{frame}
314
+ − 1012
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − 1013
360
+ − 1014
\begin{frame}[c]
+ − 1015
\begin{center}
+ − 1016
\includegraphics[scale=0.4]{../pics/fun.png}
+ − 1017
\end{center}
+ − 1018
\end{frame}
32
+ − 1019
416
+ − 1020
\begin{frame}<1-20>[t]
360
+ − 1021
+ − 1022
\end{frame}
32
+ − 1023
481
+ − 1024
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − 1025
\begin{frame}[t,fragile]
+ − 1026
\frametitle{\mbox{}\hspace{40mm}\textbf{???}}
+ − 1027
+ − 1028
\begin{textblock}{5}(2,6)
+ − 1029
\includegraphics[scale=0.35]{../pics/commits.png}
+ − 1030
\end{textblock}
+ − 1031
+ − 1032
\end{frame}
+ − 1033
+ − 1034
+ − 1035
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − 1036
22
+ − 1037
\end{document}
+ − 1038
+ − 1039
%%% Local Variables:
+ − 1040
%%% mode: latex
+ − 1041
%%% TeX-master: t
+ − 1042
%%% End:
+ − 1043
140
+ − 1044
+ − 1045
“Functional programming is often regarded as the best-kept secret of
+ − 1046
scientific modelers, mathematicians, artificial intelligence
+ − 1047
researchers, financial institutions, graphic designers, CPU designers,
+ − 1048
compiler programmers, and telecommunications engineers.â€
+ − 1049
+ − 1050
The Wikipedia F# page