66
|
1 |
\documentclass[dvipsnames,14pt,t,xelatex]{beamer}
|
|
2 |
\usepackage{../slides}
|
|
3 |
\usepackage{../graphics}
|
|
4 |
\usepackage{../langs}
|
|
5 |
%\usepackage{../data}
|
|
6 |
|
|
7 |
\hfuzz=220pt
|
|
8 |
|
|
9 |
%\setmonofont[Scale=.88]{Consolas}
|
|
10 |
%\newfontfamily{\consolas}{Consolas}
|
|
11 |
|
|
12 |
\lstset{language=Scala,
|
|
13 |
style=mystyle,
|
|
14 |
numbersep=0pt,
|
|
15 |
numbers=none,
|
|
16 |
xleftmargin=0mm}
|
|
17 |
|
|
18 |
\newcommand{\bl}[1]{\textcolor{blue}{#1}}
|
|
19 |
|
|
20 |
% beamer stuff
|
|
21 |
\renewcommand{\slidecaption}{PEP (Scala) 02, King's College London}
|
|
22 |
|
|
23 |
|
|
24 |
\begin{document}
|
|
25 |
|
|
26 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
27 |
\begin{frame}[t]
|
|
28 |
\frametitle{%
|
|
29 |
\begin{tabular}{@ {}c@ {}}
|
|
30 |
\\[5mm]
|
|
31 |
\huge PEP Scala (2)
|
|
32 |
\end{tabular}}
|
|
33 |
|
|
34 |
\normalsize
|
|
35 |
\begin{center}
|
|
36 |
\begin{tabular}{ll}
|
|
37 |
Email: & christian.urban at kcl.ac.uk\\
|
|
38 |
Office: & S1.27 (1st floor Strand Building)\\
|
|
39 |
Slides \& Code: & KEATS
|
|
40 |
\end{tabular}
|
|
41 |
\end{center}
|
|
42 |
|
|
43 |
|
|
44 |
\end{frame}
|
|
45 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
46 |
|
|
47 |
\begin{frame}[t]
|
|
48 |
\frametitle{\begin{tabular}{c}Why Scala?\end{tabular}}
|
|
49 |
|
|
50 |
|
|
51 |
\begin{itemize}
|
|
52 |
\item \large {\bf You can avoid \textcolor{blue}{\texttt{null}}}:
|
|
53 |
\end{itemize}
|
|
54 |
|
|
55 |
|
|
56 |
\begin{textblock}{6}(1,5)
|
|
57 |
\begin{bubble}[10.5cm]\small
|
|
58 |
``I call it my billion-dollar mistake. It was the invention of
|
|
59 |
the null reference in 1965. At that time, I was designing the
|
|
60 |
first comprehensive type system for references in an object
|
|
61 |
oriented language (ALGOL W). My goal was to ensure that all use
|
|
62 |
of references should be absolutely safe, with checking performed
|
|
63 |
automatically by the compiler. But I couldn't resist the
|
|
64 |
temptation to put in a null reference, simply because it was so
|
|
65 |
easy to implement. This has led to innumerable errors,
|
|
66 |
vulnerabilities, and system crashes, which have probably caused
|
|
67 |
a billion dollars of pain and damage in the last forty years.''
|
|
68 |
\hfill Sir Tony (Hoare)
|
|
69 |
\end{bubble}
|
|
70 |
\end{textblock}
|
|
71 |
|
|
72 |
\begin{textblock}{5}(11.8,1)
|
|
73 |
\includegraphics[scale=0.20]{hoare.jpg}\\
|
|
74 |
\end{textblock}
|
|
75 |
|
|
76 |
\end{frame}
|
|
77 |
|
|
78 |
|
|
79 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
80 |
\begin{frame}[c]
|
|
81 |
\frametitle{\huge\textbf{\texttt{return}}}
|
|
82 |
|
|
83 |
\begin{center}\LARGE
|
|
84 |
you should never use it
|
|
85 |
\end{center}
|
|
86 |
|
|
87 |
\end{frame}
|
|
88 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
89 |
|
|
90 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
91 |
\begin{frame}[c]
|
|
92 |
\frametitle{Types}
|
|
93 |
|
|
94 |
\begin{itemize}
|
|
95 |
\item Base types\smallskip
|
|
96 |
|
|
97 |
\begin{tabular}{@{}l@{}}
|
|
98 |
\textcolor{codegreen}{\texttt{Int}},
|
|
99 |
\textcolor{codegreen}{\texttt{Long}},
|
|
100 |
\textcolor{codegreen}{\texttt{BigInt}},
|
|
101 |
\textcolor{codegreen}{\texttt{Float}},
|
|
102 |
\textcolor{codegreen}{\texttt{Double}}\\
|
|
103 |
\textcolor{codegreen}{\texttt{String}},
|
|
104 |
\textcolor{codegreen}{\texttt{Char}}\\
|
|
105 |
\textcolor{codegreen}{\texttt{Boolean}}
|
|
106 |
\end{tabular}
|
|
107 |
|
|
108 |
\item Compound types \smallskip
|
|
109 |
|
|
110 |
\begin{tabular}{@{}ll@{}}
|
|
111 |
\textcolor{codegreen}{\texttt{List[Int]}} & lists of Int's \\
|
|
112 |
\textcolor{codegreen}{\texttt{Set[Double]}} & sets of Double's \\
|
|
113 |
\textcolor{codegreen}{\texttt{(Int, String)}} & Int-String pair\\
|
|
114 |
\textcolor{codegreen}{\texttt{List[(BigInt, String)]}} &
|
|
115 |
lists of BigInt-String\\
|
|
116 |
& pairs\\
|
|
117 |
\textcolor{codegreen}{\texttt{List[List[Int]]}} & list of lists of Int's\\
|
|
118 |
\end{tabular}
|
|
119 |
|
|
120 |
\end{itemize}
|
|
121 |
|
|
122 |
\end{frame}
|
|
123 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
124 |
|
|
125 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
126 |
\begin{frame}[c]
|
|
127 |
\frametitle{\begin{tabular}{c}\\[3cm]\alert{Questions?}\end{tabular}}
|
|
128 |
|
|
129 |
\mbox{}
|
|
130 |
\end{frame}
|
|
131 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
132 |
\end{document}
|
|
133 |
|
|
134 |
|
|
135 |
\end{document}
|
|
136 |
|
|
137 |
%%% Local Variables:
|
|
138 |
%%% mode: latex
|
|
139 |
%%% TeX-master: t
|
|
140 |
%%% End:
|
|
141 |
|