\documentclass{beamer}

\usepackage{stmaryrd}
\usepackage{listings}

\title{Do you see what I see?}
\subtitle{\emph{Functional pearl} (2016)}
\author{M.~Lubbers}
\date{\today}

\lstset{%
	basicstyle=\ttfamily\small
}

\begin{document}
\frame{\titlepage}
% Objective: what is the goal of this work, what problem is addressed, what was
% the current state of the art, who is the work aimed at?
\begin{frame}
	\frametitle{About functional pearls\ldots}
	\begin{itemize}
		\item ICFP / Journal of Functional Programming
		\item Elegance
		\item Instructive
		\item Fun
		\item Famous editors
			\begin{itemize}
				\item Prof.\ Philip Wadler
				\item \ldots
				\pause%
				\item Prof.\ Ralf Hinze
			\end{itemize}
	\end{itemize}
\end{frame}

\begin{frame}
	\frametitle{Objective}
	\begin{block}{Elaborate on the type system}
		\pause%
		\begin{itemize}
			\item Racket programming language
			\item Implemented as macro
			\item No extra syntax or annotations
			\item Syntactical/static analyses
		\end{itemize}
	\end{block}
	\pause%
	\begin{block}{Why?}
		\pause%
		\begin{itemize}
			\item Pass typechecker? Correct program\ldots
			\item Solve problems with arity(indexed)
			\item Dependant types expensive
		\end{itemize}
	\end{block}
\end{frame}

% Proposal: if the paper presents a new idea, what, in a nutshell, is it?
\begin{frame}
	\frametitle{Proposal (1)}
	\begin{block}{Notation}
		\texttt{$\llbracket$e$\rrbracket$}- Elaboration function on $e$\\
	\end{block}
	\pause%
	\begin{block}{Curry example}
		\begin{tabular}{rl}
			\texttt{$\llbracket$ (curry ($\lambda$ (x y) x)) $\rrbracket$}
				& \texttt{= (curry\_2 ($\lambda$ (x y) x))}\\
			\pause%
			\texttt{$\llbracket$ (curry ($\lambda$ (x y z) x)) $\rrbracket$}
				& \texttt{= (curry\_3 ($\lambda$ (x y z) x))}\\
			\pause%
			\texttt{$\llbracket$ (curry ($\lambda$ (x y z a) x)) $\rrbracket$}
				& \texttt{= (curry\_4 ($\lambda$ (x y z a) x))}\\
			\pause%
				&\ldots
		\end{tabular}
	\end{block}
\end{frame}

\begin{frame}
	\frametitle{Proposal (2)}
	\begin{block}{Printf type annotations}
		\pause%
		\texttt{$\llbracket$ (printf "{\textasciitilde}b" 2) $\rrbracket$}\\
		\texttt{String Any * -> Void}\\\vspace{1em}
		\pause%
		\texttt{(printf "{\textasciitilde}b" (2:: Integer))}\\
		\texttt{String Integer -> Void}
	\end{block}
\end{frame}

\begin{frame}
	\frametitle{Proposal (3)}
	\begin{block}{And much more\ldots}
		\begin{itemize}
			\item Regular expressions
			\item Database queries
			\item Fixed size vectors
			\item\ldots
		\end{itemize}
	\end{block}
\end{frame}

% Evidence: Support for claims - Theorems? Case studies? Simulations?
% Benchmarks? Does evidence address issues needed to support claims?
\begin{frame}[fragile]
	\frametitle{Implementation (1)}
	\begin{itemize}
		\item Macros
		\item Expanded recursively before computation
		\item Syntax classes
		\item 
			\begin{lstlisting}
(make-alias #'vector-length
    (syntax-parser
        [(_ v:vector/length)
            #''v.evidence]
        [_ #false]))
			\end{lstlisting}
	\end{itemize}
\end{frame}

\begin{frame}[fragile]
	\frametitle{Implementation (2)}
	\framesubtitle{Vector length}
	\begin{block}{Vector notation racket}
		\begin{lstlisting}
#(4 42 1 0)
(make-vector 4)
		\end{lstlisting}
	\end{block}

	\begin{block}{Length determination}
		\begin{lstlisting}
(define vector?
    (syntax-parser #:literals (make-vector)
        [#(e* ...)
            (length (syntax->datum #'(e* ...)))]
        [(make-vector n:num/value)
            (syntax->datum #'n.evidence)]
        [_ #false]))
		\end{lstlisting}
	\end{block}
\end{frame}

\begin{frame}
	\frametitle{Implementation (3)}
	Only vector examples given\\
	Very complex examples
\end{frame}

\begin{frame}
	\frametitle{Evidence}
	\begin{itemize}
		\item Portable to other languages with macro/templates
		\item Increased binary size of $4\%$
		\item Implemented only for some features
		\pause%
		\item No real downsides given
	\end{itemize}
\end{frame}

% Shoulders of giants...: what previous research does this work build on? What
% are the key underlying theoretical ideas? Software infrastructure?
\begin{frame}
	\frametitle{Shoulders of giants}
	\begin{itemize}
		\item Papers on macros
		\item Language/feature documentation
		\item Meta programming
		\item\ldots
	\end{itemize}
\end{frame}

% Writing: analyse the writing
\begin{frame}
	\frametitle{Writing}
	\begin{itemize}
		\item Implementation is not trivial or elegant
		\item Colors
		\item Literature\ldots a lot of documentation
		\item LISP like language knowledge
		\item Implementation sections are late
		\item Examples in not very popular functional language
			\begin{itemize}
				\item Racket: $740$
				\item {LISP}: $2620$
				\item Haskell: $2800$
				\item\ldots
			\end{itemize}
	\end{itemize}
\end{frame}

% Discussion points: end with questions which you think should arise 
\begin{frame}
	\frametitle{Discussion points}
	\begin{itemize}
		\item There should be more elaboration on the implementation.
		\item Is the addition really helpful or does it just produce more
			obfuscated compiler errors.
		\item Paper should have been written in a more famous language.
	\end{itemize}
\end{frame}

\end{document}
