\documentclass[aspectratio=1610,10pt]{beamer} \usepackage{fontspec} \usepackage[utf8]{inputenc} \usepackage[english]{babel} \usepackage{listings} \usepackage{tcolorbox} \usepackage{hyperref} \newtcbox{\mybox}{ on line, %colframe=mycolor, colback=lightgray, %boxrule=0.5pt, arc=4pt, boxsep=0pt, left=6pt, right=6pt, top=6pt, bottom=6pt } \lstdefinelanguage{Haskelln}{ language = Haskell, otherkeywords = {=>,->,::,++,!!,|,<-}, } \lstset{ frame=none, xleftmargin=2pt, stepnumber=1, numbers=none, numbersep=5pt, numberstyle=\ttfamily\tiny\color{lightgray}, belowcaptionskip=\bigskipamount, captionpos=b, escapeinside={*'}{'*}, language=Haskelln, tabsize=2, emphstyle={\bf}, commentstyle=\it, stringstyle=\mdseries\ttfamily\color{green}, showspaces=false, keywordstyle=[1]\color{cyan}\bfseries\ttfamily, keywordstyle=[2]\color{orange}\bfseries\ttfamily, keywordstyle=[3]\color{yellow}\bfseries\ttfamily, keywordstyle=[4]\color{red}\bfseries\ttfamily, keywordstyle=[5]\color{purple}\bfseries\ttfamily, keywordstyle=[6]\color{blue}\bfseries\ttfamily, %keywordstyle=\color{cyan}\ttfamily columns=flexible, basicstyle=\color{white}\small\ttfamily, showstringspaces=false, morecomment=[l]\%, emptylines=1, } % You can set fonts for Latin script here \setmainfont{FreeSerif} \setsansfont{FreeSans} \setmonofont{Fira Mono} \usetheme{DarkConsole} \begin{document} % The metadata of the presentation \title{Functional Programming} \subtitle{Using the example of Haskell} \author[]{Amedeo Molnár - \href{mailto:nek0@nek0.eu}{nek0@nek0.eu}} %\institute{SRH Berufsbildungswerk Dresden gGmbH} \date{13. Januar 2020} % Replace with date of the presentation \begin{frame}[plain] \maketitle \end{frame} \begin{frame}{Overview} \tableofcontents \end{frame} \section{Introduction} \begin{frame} \frametitle{Languages} \begin{center} \begin{tabular}{ccc} \onslide<2->{\mybox{\includegraphics[width=.2\linewidth]{pictures/Lisplogo_alien_256.png}}} & & \onslide<3->{\mybox{\includegraphics[width=.2\linewidth]{pictures/OCaml_Logo.png}}} \\ & \onslide<6->{\mybox{\includegraphics[width=.25\linewidth]{pictures/Haskell-Logo.png}}} & \\ \onslide<4->{\mybox{\includegraphics[width=.16\linewidth]{pictures/Swift-Logo.png}}} & & \onslide<5->{\mybox{\includegraphics[height=.16\linewidth]{pictures/Elixir-Logo.png}}} \end{tabular} \end{center} \end{frame} \begin{frame} \frametitle{Core Concepts} \begin{itemize} \item \underline{Pure functions}\\ {\onslide<2->{\color{lightgray}A (pure) function must produce the same result given the same input and does not rely on or alter external state.}} \item \underline{Non-imperative functions}\\ {\onslide<3->{\color{lightgray}A function is not a sequence of commands, but a nesting of other functions.}} \item \underline{First class citizens}\\ {\onslide<4->{\color{lightgray}Functions are equal to other data objects and can thus be passed as function arguments or be computation results themselves.}} \item \underline{Closures}\\ {\onslide<5->{\color{lightgray}Functions can only access variables inside context they have been created. This can happen even when the function itself has left this context. In this case the variable values are frozen at the moment of departure inside the function.}} \item \underline{Lambdas}\\ {\onslide<6->{\color{lightgray}A function definition can take place without an explicit name in the position of a function symbol.}} \end{itemize} \end{frame} \section{Main differences to imperative programming} \begin{frame} \frametitle{\secname} \begin{itemize} \item<2-> Avoidance of side effects \item<3-> No state \item<4-> No Loops \item<5-> Immutable variables \end{itemize} \end{frame} \section{Examples} \begin{frame}[fragile] \frametitle{\secname} \begin{lstlisting} sq :: (Floating a) => a -> a sq x = x * x \end{lstlisting} \vspace{1cm} \begin{lstlisting} ringArea :: (Floating a) => a -> a -> a ringArea r1 r2 = pi * (sq r1 - sq r2) \end{lstlisting} \vspace{1cm} \begin{lstlisting} fib :: Integer -> Integer fib 0 = 0 fib 1 = 1 fib n = fib (n - 2) + fib (n - 1) \end{lstlisting} \end{frame} \begin{frame} \frametitle{Advanced Example} \lstinputlisting[ basicstyle=\color{white}\fontsize{9pt}{9pt}\ttfamily ]{12days.hs} \end{frame} \section{Fields of Application} \begin{frame} \frametitle{Fields of Application} \begin{itemize} \item<2-> Big Data \item<3-> Finance Sector \item<4-> Science \item<5-> Virtually everywhere \end{itemize} \end{frame} \section{Conclusion} \begin{frame} \frametitle{Literature recommendations} \begin{itemize} \item \href{http://learnyouahaskell.com/}{Learn you a Haskell for Great Good!} \item \href{http://book.realworldhaskell.org/}{Real World Haskell} \item \href{https://www.oreilly.com/library/view/parallel-and-concurrent/9781449335939}{Parallel and Concurrent Programming in Haskell} \item \href{http://www.cs.yale.edu/homes/hudak/Papers/HSoM.pdf}{The Haskell School of Music} \end{itemize} \end{frame} \begin{frame}[plain] \begin{center} {\Huge Thank you for your attention!}\\ \vspace{1cm} This presentation is available for download at:\\ \url{https://github.com/nek0/presentation-fp-haskell} \end{center} \end{frame} \end{document}