From: Mart Lubbers Date: Tue, 22 Mar 2016 18:39:04 +0000 (+0100) Subject: finished slides for long review X-Git-Tag: first_presentation~3 X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=4c177d5a6fba0821f716961c706f4d20b2db6721;p=rsss1516.git finished slides for long review --- diff --git a/long1/long.tex b/long1/long.tex index c0e603e..b6c20fc 100644 --- a/long1/long.tex +++ b/long1/long.tex @@ -127,7 +127,7 @@ unit :: a -> M a unit :: a -> I a unit a = a ((#$\star$#)) :: (M a) (a -> M b) -> M b -a (#$\star$#) k = k a +((#$\star$#)) a k = k a \end{CleanCode} \end{block} \end{frame} @@ -146,7 +146,7 @@ unit :: a -> M a unit a = Return a ((#$\star$#)) :: (M a) (a -> M b) -> M b -m (#$\star$#) k = case m of +((#$\star$#)) m k = case m of Raise e = Raise e Return a = k a \end{CleanCode} @@ -171,7 +171,7 @@ unit :: a -> M a unit a = \x.(a, x) ((#$\star$#)) :: (M a) (a -> M b) -> M b -m (#$\star$#) k = \x.let (a, y) = m x in +((#$\star$#)) m k = \x.let (a, y) = m x in let (b, z) = k a y in (b, z) \end{CleanCode} @@ -205,14 +205,76 @@ m (#$\star$#) (\a.n (#$\star$#) \b.o) = (m (#$\star$#) \a.n) (#$\star$#) \b.o \subsection{Further evidence} \begin{frame}[fragile] - \frametitle{Further examples} - \begin{itemize}[<+->] - \item Array %TODO - \end{itemize} + \frametitle{Different approach} + \framesubtitle{Parsers (1)} + \begin{CleanCode} +:: M a = State -> [(a, State)] +:: State :== [Char] + +unit :: a -> M a +unit a = \x.[(a, x)] + +((#$\star$#)) :: (M a) (a -> M b) -> M b +((#$\star$#)) m k = \x.[(b, z) \\ (a, y) <- m x, (b, z) <- k a y] + \end{CleanCode} +\end{frame} + +\begin{frame}[fragile] + \frametitle{Different approach} + \framesubtitle{Parsers (2)} + \begin{CleanCode} +zero :: M a +zero = \x.[] + +((#$\oplus$#)) :: (M a) (M a) -> M a +((#$\oplus$#)) m n = \x.m x ++ n x + +((#$\triangleright$#)) :: (M a) (a -> Bool) -> M a +((#$\triangleright$#)) m p = m (#$\star$#) \a.if (p a) (unit a) zero + +item :: M Char +item [] = [] +item [a:x] = [(a, x)] + \end{CleanCode} +\end{frame} + +\begin{frame}[fragile] + \frametitle{Different approach} + \framesubtitle{Parsers (3)} + \begin{CleanCode} +iterate :: M a -> M [a] +iterate m = (m (#$\star$#) \a.iterate m (#$\star$#) \x.unit [a:x]) (#$\oplus$#) unit [] + +iterate (item (#$\triangleright$#) isDigit) "23 and more" +[([2,3], " and more"), ([2], "3 and more"), ([], "23 and more")] + \end{CleanCode} + \pause + \begin{CleanCode} +((#$\oslash$#)) :: (M a) (M a) -> M a +((#$\oslash$#)) m n = \x.if (m x <> []) (m x) (n x) + \end{CleanCode} \end{frame} \section{Discussion} \begin{frame} + \begin{block}{Writing style} + \begin{itemize}[<+->] + \item Pleasure to read + \item Classical problems + \item Fancy words + \end{itemize} + \end{block} + \pause + \begin{block}{Discussion queries} + \begin{itemize}[<+->] + \item Toy implementations, bigger? + \item Would the last section about parsers be a paper on its own? + \end{itemize} + \end{block} +\end{frame} + +\begin{frame} + \frametitle{Questions or discussion points?} \end{frame} \end{document} diff --git a/long1/pre.tex b/long1/pre.tex index ada3c0b..bd9e489 100644 --- a/long1/pre.tex +++ b/long1/pre.tex @@ -3,7 +3,7 @@ \usepackage{clean} \usecolortheme{dove} -\usetheme{Singapore} +\beamertemplatenavigationsymbolsempty% \title[RSSS]{Monads for functional programming\\P.\ Wadler} \subtitle{Originally published in Springer's \emph{Program Design Calculi} in