Spirit and Karma

 

Changeset 943

Show
Ignore:
Timestamp:
4/30/2008 4:30:27 PM (2 years ago)
Author:
dan_marsden
Message:

improvements to haskell datatypes introduction

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/traversal/libs/traversal/doc/boostcon/haskell.tex

    r938 r943  
    11\section{Data structures in Haskell} 
     2 
     3\begin{frame}[fragile]{Structure like types} 
     4\begin{lstlisting} 
     5  data Struct = Struct Int String Float 
     6\end{lstlisting} 
     7\begin{block}{Details} 
     8  \begin{itemize} 
     9    \item Read this \lstinline !Int! \emph{and} \lstinline !String! \emph{and} \lstinline !Float! 
     10    \item Other more complex data types are built similarly 
     11  \end{itemize} 
     12\end{block} 
     13\end{frame} 
     14 
     15\begin{frame}[fragile]{Enumerations} 
     16\begin{lstlisting}[language=Haskell] 
     17  data Colors = Red | Blue | Yellow 
     18\end{lstlisting} 
     19\begin{block}{Details} 
     20  \begin{itemize} 
     21    \item Read this as \lstinline !Red! \emph{or} \lstinline !Blue! \emph{or} \lstinline !Yellow! 
     22    \item Another fundamental way of building up types 
     23  \end{itemize} 
     24\end{block} 
     25\end{frame} 
    226 
    327\begin{frame}[fragile]{Natural numbers} 
     
    1034\pause 
    1135\lstinline !Succ (Succ Zero)! 
     36\pause 
     37\begin{block}{Details} 
     38  \begin{itemize} 
     39    \item Recursive type definition 
     40    \item Yet another fundamental building block 
     41  \end{itemize} 
     42\end{block} 
    1243\end{frame} 
    1344 
     
    2152\pause 
    2253\lstinline !Cons 101 (Cons 202 (Cons 303 Nil))! 
     54\pause 
     55\begin{block}{Details} 
     56  \begin{itemize} 
     57    \item Polymorphic type 
     58    \item Our final variation of interest 
     59  \end{itemize} 
     60\end{block} 
    2361\end{frame} 
    2462 
     
    3674\end{frame} 
    3775 
    38 \begin{frame}[fragile]{Functions} 
     76\begin{frame}[fragile]{Functions in Haskell} 
     77\begin{lstlisting} 
     78  length :: [a] -> Int 
     79  length []     = 0 
     80  length (x:xs) = 1 + length xs 
     81\end{lstlisting} 
     82\begin{block}{Details} 
     83  \begin{itemize} 
     84    \item Functions defined on patterns 
     85    \item Multiple definitions can be provided for different patterns 
     86    \item Recursion is commonplace 
     87  \end{itemize} 
     88\end{block} 
     89\end{frame} 
     90 
     91\begin{frame}[fragile]{Pointless definitions} 
    3992\begin{lstlisting}[language=Haskell] 
    4093  foldr f e [] = e 
     
    47100\end{lstlisting} 
    48101\pause 
     102\begin{lstlisting} 
     103  length = foldr (+) 0 
     104\end{lstlisting} 
     105\end{frame} 
     106 
     107\begin{frame}[fragile]{Some common functions} 
    49108\begin{lstlisting}[language=Haskell] 
    50109  foldl f e [] = e 
  • branches/traversal/libs/traversal/doc/boostcon/introduction.tex

    r940 r943  
    11\section{Introduction} 
    22 
    3  \begin{frame}{Why is this relevant to Boostcon?} 
    4    \begin{itemize} 
    5     \item Experience translating theory from another language 
    6     \item The library touches a lot of existing parts of Boost 
    7     \item Hopefully the library is interesting in its own right 
    8     \item I'm always after feedback! 
    9    \end{itemize} 
    10  \end{frame} 
     3\begin{frame}{Scrap your boilerplate} 
     4\begin{block}{Context} 
     5  \begin{itemize} 
     6    \item Manipulating complex data structures in many languages is 
     7      dull repetitive work 
     8    \pause 
     9    \item There is a lot of literature in the Haskell community concerned 
     10      with simplifying work with complex data structures 
     11    \pause 
     12    \item The current state of the art is C++ is is masses of deeply nested 
     13      iteration - either loops or algorithm calls 
     14  \end{itemize} 
     15\end{block} 
     16\end{frame} 
     17 
     18\begin{frame}{Why is this relevant to Boostcon?} 
     19  \begin{itemize} 
     20  \item Experience translating theory from another language 
     21  \item The library touches a lot of existing parts of Boost 
     22  \item Hopefully the library is interesting in its own right 
     23  \item I'm always after feedback! 
     24  \end{itemize} 
     25\end{frame}