# HG changeset patch # User Christian Urban # Date 1668109264 0 # Node ID c86e7dd198bf9e6a8990dd65be7b9a6b6aa9118e # Parent 3bfe819726741650c574bfb825c02a8f416ea9b8 updated diff -r 3bfe81972674 -r c86e7dd198bf handouts/pep-ho.pdf Binary file handouts/pep-ho.pdf has changed diff -r 3bfe81972674 -r c86e7dd198bf handouts/pep-ho.tex --- a/handouts/pep-ho.tex Thu Nov 10 09:52:40 2022 +0000 +++ b/handouts/pep-ho.tex Thu Nov 10 19:41:04 2022 +0000 @@ -1806,7 +1806,7 @@ for writing more elegant code. Unfortunately, I have not yet managed to switch over my code to Scala 3.0 due to time constraints. Scala 3 seems to iron out a number of snags from Scala 2, but why on earth are they -introducing Python-esque intendation and why on earth are they +introducing Python-esque indentation and why on earth are they re-introducing the \texttt{then}-keyword in Scala 3, when I just about got comfortable without it? diff -r 3bfe81972674 -r c86e7dd198bf pics/appleair.png Binary file pics/appleair.png has changed diff -r 3bfe81972674 -r c86e7dd198bf pics/appleg4.jpg Binary file pics/appleg4.jpg has changed diff -r 3bfe81972674 -r c86e7dd198bf pics/applepro.jpg Binary file pics/applepro.jpg has changed diff -r 3bfe81972674 -r c86e7dd198bf pics/guardian.jpg Binary file pics/guardian.jpg has changed diff -r 3bfe81972674 -r c86e7dd198bf pics/happy.jpg Binary file pics/happy.jpg has changed diff -r 3bfe81972674 -r c86e7dd198bf pics/skeleton.jpg Binary file pics/skeleton.jpg has changed diff -r 3bfe81972674 -r c86e7dd198bf pics/throwup.jpg Binary file pics/throwup.jpg has changed diff -r 3bfe81972674 -r c86e7dd198bf slides.sty --- a/slides.sty Thu Nov 10 09:52:40 2022 +0000 +++ b/slides.sty Thu Nov 10 19:41:04 2022 +0000 @@ -1,11 +1,13 @@ \usepackage[absolute,overlay]{textpos} \usepackage{xcolor} \usepackage[no-math]{fontspec} +%%\usepackage{marginnote} +\usepackage{fontawesome5} %%%%% CODE FONT %\setmonofont[Scale=.95]{Consolas} \setmonofont[Scale=.88]{Consolas} -%\newfontfamily{\consolas}{Consolas} +\newfontfamily{\consolas}{Consolas} %%%%% MATHFONT \usepackage[sc]{mathpazo} @@ -48,6 +50,12 @@ \newcommand{\dn}{\stackrel{\mbox{\scriptsize def}}{=}}% \newcommand{\slidecaption}{} +%%% url pointers +\newcommand{\here}[1]{\href{#1}{\small\textcolor{ProcessBlue}{\faHandPointRight[regular]}}} +\newcommand{\video}[1]{\href{#1}{\small\textcolor{ProcessBlue}{\faFilm}}} +%%\newcommand{\alert}{\reversemarginpar\marginpar{\mbox{}\hfill\textcolor{red}{\faExclamationTriangle}}} + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Frametitles @@ -84,7 +92,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%\beamertemplateballitem +% \beamertemplateballitem \setbeamertemplate{itemize item}[ball] \setbeamertemplate{itemize subitem}[ball] \setbeamertemplate{itemize subsubitem}[ball] diff -r 3bfe81972674 -r c86e7dd198bf slides/slides01.pdf Binary file slides/slides01.pdf has changed diff -r 3bfe81972674 -r c86e7dd198bf slides/slides01.tex --- a/slides/slides01.tex Thu Nov 10 09:52:40 2022 +0000 +++ b/slides/slides01.tex Thu Nov 10 19:41:04 2022 +0000 @@ -1,12 +1,12 @@ % !TEX program = xelatex \documentclass[dvipsnames,14pt,t,xelatex,aspectratio=169,xcolor={table}]{beamer} -\usepackage{../slides} -\usepackage{../graphics} -\usepackage{../langs} +\usepackage{../styles/slides} +\usepackage{../styles/mygraphs} +\usepackage{../styles/langs} %\usepackage{../data} -\usetikzlibrary{shapes} +\usetikzlibrary{shapes} -\hfuzz=220pt +\hfuzz=220pt %\setmonofont[Scale=.88]{Consolas} %\newfontfamily{\consolas}{Consolas} @@ -109,7 +109,11 @@ Email: & christian.urban at kcl.ac.uk\\ %Office: & N\liningnums{7.07} (North Wing, Bush House)\bigskip\\ Slides \& Code: & KEATS\bigskip\\ - %Office Hours: & Thursdays 12:00 -- 14:00\\ + + Office Hour: & Fridays 11:00 -- 12: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} @@ -132,7 +136,7 @@ \begin{textblock}{6}(3,3) \begin{tabular}{l} -\mbox{}\hspace{-1mm}\includegraphics[scale=0.36]{../pics/twitter.png}\\[-1mm] +%%\mbox{}\hspace{-1mm}\includegraphics[scale=0.36]{../pics/twitter.png}\\[-1mm] \includegraphics[scale=0.30]{../pics/linked.png}\\ \includegraphics[scale=0.30]{../pics/guardian.jpg}\\[-3mm] \mbox{}\hspace{-2mm}\includegraphics[scale=0.38]{../pics/morgan.png}\\[-3mm] diff -r 3bfe81972674 -r c86e7dd198bf wsheets/wsh01.tex --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wsheets/wsh01.tex Thu Nov 10 19:41:04 2022 +0000 @@ -0,0 +1,122 @@ +% !TEX program = xelatex +\documentclass{article} +\usepackage{../styles/style} +\usepackage{../styles/langs} +\usepackage{tikz} +\usepackage{pgf} +\usepackage{marvosym} +\usepackage{boxedminipage} + +\lstset{escapeinside={/*!}{!*/}} +\newcommand{\annotation}[1]{\hfill\footnotesize{}#1} + +\usepackage{menukeys} + + +% Exact colors from NB +\usepackage[breakable]{tcolorbox} +\definecolor{incolor}{HTML}{303F9F} +\definecolor{outcolor}{HTML}{D84315} +\definecolor{cellborder}{HTML}{CFCFCF} +\definecolor{cellbackground}{HTML}{F7F7F7} + + + +\begin{document} +\fnote{\copyright{} Christian Urban, King's College London, 2022} + +\section*{Scala Worksheet 1} + +Please install Scala on your work-machine: You should have +Scala up and running, and also an IDE that allows you to +access the Scala REPL. Some instructions are given at + +\begin{center} +\url{https://www.scala-lang.org/download/2.13.10.html} +\end{center} + +\subsubsection*{MacOSX} + +\begin{itemize} +\item[0)] (if needed) \texttt{brew install java} \;\;or\;\; \texttt{brew reinstall java} +\item[1)] \texttt{brew install scala@2.13} +\end{itemize} + +\noindent Another method to install Scala on MacOSX + +\begin{itemize} +\item[1)] \texttt{curl -s "https://get.sdkman.io" | bash} +\item[2)] \texttt{sdk install scala 2.13.10} +\end{itemize} + +\subsubsection*{Windows / Linux Ubuntu} + +\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.10/scala-2.13.7.deb}} +\item[2)] \texttt{sudo dpkg -i scala-2.13.10.deb} +\end{itemize} + +\noindent +Other Linux distros: \texttt{sudo apt-get scala}\bigskip + +\noindent In the end you should have something running like + +\begin{lstlisting}[language={},numbers=none,basicstyle=\ttfamily\small] +$ scala +Welcome to Scala 2.13.10 (OpenJDK 64-Bit Server VM, Java 17.0.1). +Type in expressions for evaluation. Or try :help. + +scala> +\end{lstlisting}%$ + +\newpage + +\subsection*{Task 1} + +`Play' with the Scala REPL and try out the following querries. Observe +what Scala responds. + +\begin{lstlisting}[numbers=none] +scala> 2 + 2 +scala> 1 / 2 +scala> 1.0 / 2 +scala> 1 / 2.0 +scala> 1 / 0 +scala> 1.0 / 0.0 +scala> true == false +scala> true && false +scala> 1 > 1.0 +scala> "12345".length +scala> List(1,2,1).size +scala> Set(1,2,1).size +scala> List(1) == List(1) +scala> Set(1,2,3) == Set(3,2,1) +scala> Array(1) == Array(1) +scala> Array(1).sameElements(Array(1)) +\end{lstlisting} + +\subsection*{Task 2 (Vals)} + +scala> val z = 42 +scala> z = z + 1 +scala> val z = 466 + +\subsection*{Task 3} + +\begin{lstlisting}[numbers=none] +scala> println("Hello " ++ "World") +scala> +\end{lstlisting} + +\begin{lstlisting}[numbers=none] +scala> println("Hello " ++ "World") +scala> +\end{lstlisting} + +\end{document} + +%%% Local Variables: +%%% mode: latex +%%% TeX-master: t +%%% End: