% mrh 17/1 2013
\documentclass[9pt,xcolor=dvipsnames]{beamer}
%\documentclass[handout,9pt,xcolor=dvipsnames]{beamer}
% This file is a solution template for:

% - Giving a talk on some subject.
% - The talk is between 15min and 45min long.
% - Style is ornate.
% Copyright 2004 by Till Tantau <tantau@users.sourceforge.net>.
%
% In principle, this file can be redistributed and/or modified under
% the terms of the GNU Public License, version 2.
%
% However, this file is supposed to be a template to be modified
% for your own needs. For this reason, if you use this file as a
% template and not specifically distribute it as part of a another
% package/program, I grant the extra permission to freely copy and
% modify this file as you see fit and even to delete this copyright
% notice.


\mode<presentation>
{
  \usetheme{DTU}
  % or ...


  \setbeamercovered{transparent}

  % or whatever (possibly just delete it)
}

\usepackage[english]{babel}
% or whatever

\usepackage[latin1]{inputenc}
% or whatever

\usepackage{palatino}
%\usepackage[T1]{fontenc}
\usepackage{mrhalltt}
\usepackage{itemlist}
%\usepackage{fix-cm}

\input{macros}

% Or whatever. Note that the encoding and the font should match. If T1
% does not look nice, try deleting the line with the fontenc.

%\usepackage{pgfpages}
%\pgfpagesuselayout{4 on 1}[letterpaper,landscape,bordershrink=5mm]

\title % (optional, use only with long paper titles)
{02157 Functional Programming}

\subtitle
{Lecture 2: Functions, Basic Types and Tuples} % (optional)

\author% (optional, use only with lots of authors)
{Michael~R.~Hansen}
% - Use the \inst{?} command only if the authors have different
%   affiliation.

\institute % (optional, but mostly needed)
{DTU Informatics, Technical University of Denmark}

\date {MRH 13/09/2012}% (optional)
%{Advanced Topics on Embedded Systems}

%\subject{Talks}
% This is only inserted into the PDF information catalog. Can be left
% out.



% If you have a file called "university-logo-filename.xxx", where xxx
% is a graphic format that can be processed by latex or pdflatex,
% resp., then you can add a logo as follows:

 \pgfdeclareimage[height=.75cm]{university-logo}{DTUlogo}
 \logo{\pgfuseimage{university-logo}}

 \pgfdeclareimage[height=3.3cm]{frise}{DTUfrise}
 \pgfdeclareimage[height=.8cm]{dept}{DTUInformatics}


% If you wish to uncover everything in a step-wise fashion, uncomment
% the following command:

%\beamerdefaultoverlayspecification{<+->}

\begin{document}

\begin{frame}
  \titlepage
%  \begin{tabular}{p{5cm}p{10cm}}
%    &\pgfuseimage{frise}\\
%    \pgfuseimage{dept} &
%  \end{tabular}

\end{frame}

\begin{frame}{Outline}
  \begin{itemize}
  \item A further look at functions, including higher-order (or curried) functions

  \item A further look at basic types, including characters, equality and ordering

  \item A first look at polymorphism

  \item A further look at tuples and patterns

  \item A further look at lists and list recursion

  \end{itemize}

\medskip
\pause

Goal: By the end of the day you are acquainted with a major part
of the F\# language.

\end{frame}



\begin{frame}[fragile]
\frametitle{Anonymous functions}

Function expressions with general patterns, e.g.\

\begin{alltt}\blue
function
 | 2        -> 28  // February
 |4|6|9|11  -> 30  // April, June, September, November
 | _        -> 31  // All other months
;;
\end{alltt}


\pause
\medskip

Simple function expressions, e.g.\
\begin{alltt}\blue
fun r -> System.Math.PI * r * r ;;
\ett{val it : float -> float = <fun:clo@10-1>}

it 2.0 ;;
\ett{val it : float = 12.56637061}
\end{alltt}

\end{frame}


\begin{frame}[fragile]
\frametitle{Anonymous functions}

Simple functions expressions with {\em\redbrown currying}
\[\blue
\mathtt{fun}\ x\ y\ \cdots\ z\ \to e
\]
with the same meaning as
\[\blue
\mathtt{fun}\ x \to (\mathtt{fun}\ y \to ( \cdots\ (\mathtt{fun}\ z \to e) \cdots ))
\]

\pause

For example: The function below takes an integer as argument and returns a function of type {\redbrown \verb!int -> int!} as value:
\begin{alltt}\blue
fun x y -> x + x*y;;
\ett{val it : int -> {\redbrown int -> int} = <fun:clo@2-1>}
\end{alltt}

\pause

\begin{alltt}\blue
let f = it 2;;
\ett{val f : ({\redbrown int -> int})}
\end{alltt}
\pause

\begin{alltt}\blue
f 3;;
\ett{val it : int = 8}
\end{alltt}

\pause

\begin{center}\blue
Functions are {\redbrown first class citizens}:\\ the argument and the value of a function may be functions
\end{center}
\end{frame}

\begin{frame}[fragile]
\frametitle{Function declarations}

A simple function declaration:
\[{\blue
\mathtt{let}\ f\ x\ =\ e}
\qquad \textrm{means} \qquad
{\blue \mathtt{let}\ f\ =\ \mathtt{fun}\ x\ \to e}
\]


For example: {\blue}
\verb!let circleArea r =  System.Math.PI *r*r!

\medskip
\pause

A declaration of a {\redbrown curried function}
\[\blue
\mathtt{let}\ f\ x\ y\ \cdots z =\ e
\]
has the same meaning as:
\[\blue
\mathtt{let}\ f\ =\ \mathtt{fun}\ x \to (\mathtt{fun}\ y \to ( \cdots\ (\mathtt{fun}\ z \to e) \cdots ))
\]

\pause


For example:
\begin{alltt}\blue
let addMult x y = x + x*y;;
\ett{val addMult : int -> int -> int}

let f = addMult 2;;
\ett{val f : (int -> int)}

f 3;;
\ett{val it : int = 8}
\end{alltt}

\end{frame}

\begin{frame}[fragile]
\frametitle{An example}

Suppose that we have a cube with side length $\blue s$,
containing a liquid with density $\blue \rho$. The weight of the liquid is then
given by $\blue \rho \cdot s^3$:

\begin{alltt}\blue
let weight ro s = ro * s ** 3.0;;
\ett{val weight : float -> float -> float}
\end{alltt}

\pause

We can make {\em\redbrown partial evaluations} to define functions for
computing the weight of a cube of either water or methanol:
\begin{alltt}\blue
let waterWeight = weight 1000.0;;
\ett{val waterWeight : (float -> float)}

waterWeight 2.0;;
\ett{val it : float = 8000.0}
\end{alltt}

\pause

\begin{alltt}\blue
let methanolWeight = weight 786.5 ;;
\ett{val methanolWeight : (float -> float)}

methanolWeight 2.0;;
\ett{val it : float = 6292.0}
\end{alltt}

\end{frame}

\begin{frame}{Patterns}

We have in previous examples exploited the pattern matching in function expression:
\[\blue
\begin{array}{l}
\mathtt{function}\\
\begin{array}{rcl}
|\ \mathit{pat_1} & \to & e_1\\
\ & \vdots & \\
|\ \mathit{pat_n} & \to & e_n
\end{array}
\end{array}
\]

\medskip
\pause

A {\blue match expression} has a similar pattern matching feature:
\[\blue
\begin{array}{l}
\mathtt{match}\ e\ \mathtt{with} \\
\begin{array}{rcl}
|\ \mathit{pat_1} & \to & e_1\\
\ & \vdots & \\
|\ \mathit{pat_n} & \to & e_n
\end{array}
\end{array}
\]
The value of $\blue e$ is computed and the expressing $e_i$ corresponding to the first matching pattern is chosen for further evaluation.
\end{frame}

\begin{frame}[fragile]{Example}
Alternative declarations of the power function:
\begin{alltt}\blue
let rec power = function
 | (\_,0) -> 1.0
 | (x,n) -> x * power(x,n-1);;
\end{alltt}

\pause
are

\begin{alltt}\blue
let rec power a = match a with
                  | (_,0) -> 1.0
                  | (x,n) -> x * power(x,n-1);;
\end{alltt}

\pause
and

\begin{alltt}\blue
let rec power(x,n) = match n with
                     | 0  -> 1.0
                     | n' -> x * power(x,n'-1);;
\end{alltt}



\end{frame}

\begin{frame}[fragile]
\frametitle{Infix functions}

The prefix version $\blue (\oplus)$ of an infix operator $\blue \oplus$ is a curried function.

\medskip

For example:
\begin{alltt}\blue
(+);;
\ett{val it : (int -> int -> int) = <fun:it@1>}
\end{alltt}

\pause
\medskip

Arguments can be supplied one by one:
\begin{alltt}\blue
let plusThree = (+) 3;;
\ett{val plusThree : (int -> int)}

plusThree 5;;
\ett{val it : int = 8}

\end{alltt}

\end{frame}

\begin{frame}[fragile]{Function composition: {\redbrown $(f \circ g)(x) = f(g(x))$}}

%If $\blue f: A \to B$ and $\blue g: C \to A$, then $\blue f \circ g : C \to B$

%\medskip
For example, if $\blue f(y) = y+3$ and $\blue g(x) = x^2$, then $\blue (f \circ\ g)(z) = z^2 +3$.

\medskip
\pause

The infix operator {\redbrown \verb-<<-} in F{\#} denotes functional composition:

\begin{alltt}\blue
let f y = y+3;;        // f(y) = y+3

let g x = x*x;;        // g(x) = x*x

let h = f << g;;       // h = (f o g)
\ett{val h : int -> int}

h 4;;                  // h(4) = (f o g)(4)
\ett{val it : int = 19}
\end{alltt}

\medskip

\pause
Using just anonymous functions:

\begin{alltt}\blue
((fun y -> y+3) << (fun x -> x*x)) 4;;
\ett{val it : int = 19}
\end{alltt}
\pause \ \hfill {\redbrown Type of (\verb!<<!) ?}
\end{frame}


\begin{frame}[fragile]
\frametitle{Basic Types: equality and ordering}

The basic types: integers, floats, booleans, and strings type were covered last week. Characters are considered on the next slide.

For these types (and many other) equality and ordering are defined.

\medskip

In particular, there is a function:
\[\blue
\verb/compare/\ x\ y\ \ =\ \ \left\{ \begin{array}{rl}
                             > 0 & \mbox{if $x > y$} \\
                               0 & \mbox{if $x = y$} \\
                            < 0  & \mbox{if $x < y$}
                            \end{array}
                     \right.
\]

\pause

For example:
\begin{alltt}\blue
compare 7.4 2.0;;
\ett{val it : int = 1}

compare "abc" "def";;
\ett{val it : int = -3}

compare 1 4;;
\ett{val it : int = -1}
\end{alltt}

\end{frame}

\begin{frame}[fragile]
\frametitle{Pattern matching with guards}

It is often useful to have {\blue when guards} in patterns:

\begin{alltt}
let ordText x y = match compare x y with
                  | t{\blue when t > 0} -> "greater"
                  | 0            -> "equal"
                  | _            -> "less";;

ordText "abc" "Abc";;
\ett{val it : bool = true}
\end{alltt}

The first clause is only taken when \texttt{\blue t > 0} evaluates to true.

\end{frame}

\begin{frame}[fragile]
\frametitle{Polymorphism and comparison}

The type of \texttt{ordText}
\begin{alltt}\blue
val ordText : 'a -> 'a -> string when 'a : comparison
\end{alltt}
contains
\begin{itemize}
\item a {\blue type variable} \verb!'a!, and
\item a {\blue type constraint} \verb!'a : comparison!
\end{itemize}

\medskip

The type variable can be instantiated to any type {\blue provided} comparison is defined for that type. It is called a {\blue polymorphic type}.

\pause
\medskip

For example:
\begin{alltt}
ordText true false;;
\ett{val it : string = "greater"}

ordText (1,true) (1,false);;
\ett{val it : string = "greater"}

ordText sin cos;;
\ett{... '('a -> 'a)' does not support the 'comparison' ...}
\end{alltt}
\begin{center}\redbrown
Comparison is not defined for types involving functions.
\end{center}
\end{frame}



\begin{frame}[fragile]
\frametitle{Characters}

Type name: {\blue \texttt{char}}

\bigskip

{\blue Values} \texttt{'a'},\ \ \texttt{' '},\ \ \verb-'-{\darkgreen \verb-\'-}\verb-'-\ \
(escape sequence for {\darkgreen \texttt{'}})

\bigskip
\pause

Examples
\begin{alltt}\blue
let isLowerCaseVowel ch =
     System.Char.IsLower ch &&
     (ch='a' || ch='e' || ch = 'i' || ch='o' || ch = 'u');;
\ett{val isLowerCaseVowel : char -> bool}

isLowerCaseVowel 'i';;
\ett{val it : bool = true}

isLowerCaseVowel 'I';;
\ett{val it : bool = false}
\end{alltt}

\medskip
\pause

The $\blue i$'th character in a string is achieved using the "dot"-notation:
\begin{alltt}\blue
"abc".[0];;
\ett{val it : char = 'a'}
\end{alltt}



\end{frame}

\begin{frame}{Overloaded Operators and Type inference}

{\blue A squaring function on integers:}
\medskip

\begin{tabular}{l|l|l}
Declaration & Type & \\ \hline \texttt{let square x = x * x} &
\texttt{int -> int} & Default
\end{tabular}

\bigskip
\pause

{\blue A squaring function on floats:} \texttt{square: float ->
float}

\medskip

\begin{tabular}{l|l}
Declaration & \\ \hline \onslide<3->{\texttt{let
square({\darkgreen x}:float) = x * x}} &
\onslide<3->{\darkgreen Type the argument}\\
\onslide<4->{\texttt{let {\darkgreen square x}:float = x * x}} &
\onslide<4->{\darkgreen Type the result}\\
\onslide<5->{\texttt{let square x = {\darkgreen x * x}: float}} &
\onslide<5->{\darkgreen Type expression for the result}\\
\onslide<6->{\texttt{let square x = {\darkgreen x}:float * x}} &
\onslide<6->{\darkgreen Type a variable}\\
\end{tabular}

\bigskip
\onslide<7->{\blue You can mix these possibilities}
\end{frame}




\begin{frame}[fragile]{Tuples}

{\blue An ordered collection of $n$ values {\redbrown $(v_1, v_2,
\ldots, v_n)$}
  is called an {\redbrown $n$-tuple}}

\medskip

{\blue Examples}

\begin{tabular}{l|l}
\hline
\begin{tabular}{l}
\verb!(3, false);!\\
\ett{val it = (3, false) : int * bool}
\end{tabular}
& $2$-tuples (pairs)\\ \hline
\begin{tabular}{l}
\verb!(1, 2, ("ab",true));!\\
\ett{val it = (1, 2, ("ab", true)) :} {\redbrown ?}
\end{tabular}
& $3$-tuples (triples)\\ \hline
\end{tabular}


\bigskip
\pause

{\blue Equality defined componentwise, ordering lexicographically}

\medskip

\begin{tabular}{l}
\verb!(1, 2.0, true) = (2-1, 2.0*1.0, 1<2);;!\\
\ett{val it = true : bool}\\[2mm] \pause
\verb!compare (1, 2.0, true) (2-1, 3.0, false);;!\\
\ett{val it : int = -1}
\end{tabular}

\hfill {\redbrown provided = is defined on components}

\end{frame}

\begin{frame}[fragile]{Tuple patterns}

{\redbrown Extract components of tuples}

\medskip

\begin{tabular}{l}
\verb!let ((x,_),(_,y,_)) = ((1,true),("a","b",false));;!\\
\ett{val x : int = 1}\\
\ett{val y : string = "b"}
\end{tabular}

\medskip
{\blue Pattern matching yields bindings}

\bigskip
\pause

{\blue Restriction}

\medskip

\begin{tabular}{l}
\verb?let (x,x) = (1,1);;?\\
\ett{...}\\
\ett{ ... ERROR ... 'x' is bound twice in this pattern}
\end{tabular}

\end{frame}



\begin{frame}[fragile]
\frametitle{Local declarations}

Examples
\begin{alltt}\blue
let g x =
   let a = 6
   let f y = y + a
   x + f x;;
\ett{val g : int -> int}

g 1;;
\ett{val it : int = 8}
\end{alltt}
Note: {\blue a} and {\blue f} are not visible outside of {\blue g}


\end{frame}



\begin{frame}[fragile]
\frametitle{{\blue Declaration of {\redbrown types} and {\redbrown
exceptions}}}

Example:  Solve $a x^2 + b x + c = 0$

{\redbrown
\begin{verbatim}
   type Equation = float * float * float
   type Solution = float * float
   exception Solve;  (* declares an exception *)
\end{verbatim}
}
 \
\pause

\begin{verbatim}
let solve(a,b,c) =
     if b*b-4.0*a*c < 0.0 || a = 0.0 then raise Solve
     else ((-b + sqrt(b*b-4.0*a*c))/(2.0*a),
           (-b - sqrt(b*b-4.0*a*c))/(2.0*a));;
val solve : float * float * float -> float * float
\end{verbatim}

\medskip

The type of the function \texttt{\redbrown solve} is (the expansion of)
\begin{center}
\texttt{\redbrown Equation -> Solution}
\end{center}

\bigskip
\begin{center}
{\color{OliveGreen} \verb-d- is declared once and used 3 times
\hfill \color{BrickRed} readability, efficiency}
\end{center}
\end{frame}


\begin{frame}[fragile]\frametitle{Solution using local declarations}


\begin{verbatim}
let solve(a,b,c) =
    let d = b*b-4.0*a*c
    if d < 0.0 || a = 0.0 then raise Solve else
    ((-b + sqrt d)/(2.0*a),(-b - sqrt d)/(2.0*a));;
\end{verbatim}

\pause
\bigskip

\begin{verbatim}
let solve(a,b,c) =
    let sqrtD =
      let d = b*b-4.0*a*c
      if d < 0.0 || a = 0.0 then raise Solve
      else sqrt d
    ((-b + sqrtD)/(2.0*a),(-b - sqrtD)/(2.0*a));;
\end{verbatim}

\begin{center}\redbrown
Indentation matters
\end{center}

\end{frame}



\begin{frame}[fragile]\frametitle{Example: Rational Numbers}

Consider the following {\redbrown signature}, specifying
operations and their types:

\bigskip

\begin{tabular}{|l|l|}
\hline
{\bf Specification} & {\bf Comment}\\
\hline
type qnum = int * int & rational numbers\\[1mm]
exception QDiv        & division by zero\\[1mm]
mkQ: int * int \ \ $\rightarrow$ qnum & construction of rational numbers  \\[1mm]
.+.:  qnum * qnum $\rightarrow$ qnum & addition of rational numbers \\[1mm]
.-.:  qnum * qnum $\rightarrow$ qnum& subtraction of rational numbers\\[1mm]
.*.:  qnum * qnum $\rightarrow$ qnum & multiplication of rational numbers\\[1mm]
./.:  qnum * qnum $\rightarrow$ qnum & division of rational numbers\\[1mm]
.=.:  qnum * qnum $\rightarrow$ bool & equality of rational numbers \\[1mm]
toString: qnum\ \ $\rightarrow$ string & String representation\\
                            & of rational numbers\\
\hline
\end{tabular}

\end{frame}

\begin{frame}[fragile]\frametitle{Intended use}
\begin{tabular}{lcl}
\onslide<2->{let q1 = mkQ(2,3);;} & &  $\blue q_1 = \frac{2}{3}$
\\[3mm]
\onslide<2->{let q2 = mkQ(12, -27);;} & & $\blue q_2 =
-\frac{12}{27} \darkgreen =
-\frac{4}{9}$ \\[3mm]
\onslide<2->{let q3 = mkQ(-1, 4) .*. q2 .-. q1;;} & & $\blue
q_3 =
-\frac{1}{4}\cdot q_2 - q_1 \darkgreen = -\frac{5}{9}$ \\[3mm]
%& & \onslide<2->{ $ = -\frac{1}{4} \cdot -\frac{4}{9} -
%\frac{2}{3} = \frac{1}{9} - \frac{2}{3} = -\frac{5}{9}$}
%\\[3mm]
\onslide<2->{let q4 = q1 .-. q2 ./. q3;;} & & $\blue q_4 = q_1 - q_2
/ q_3 \darkgreen = \frac{2}{3} - \frac{-4}{9} / \frac{-5}{9}$
\\[3mm]
%& & \onslide<2->{$ = \frac{2}{3} - \frac{4}{9}\cdot \frac{9}{5}$}\\[3mm]
\onslide<2->{toString q4;;} & &  \\
\onslide<2->{\ett{val it : string = "-2/15"}} & &
$\darkgreen = -\frac{2}{15}$
\end{tabular}

\bigskip
\pause

\begin{center}
{\redbrown Operators are infix with usual precedences}
\end{center}

\pause
\bigskip

Note: Without using infix:
\begin{verbatim}
let q3 = (.-.)((.*.) (mkQ(-1,4)) q2) q1;;
\end{verbatim}

\end{frame}


\begin{frame}[fragile]\frametitle{Representation: $\blue (a,b)$, $b > 0$ and $\mathtt{\redbrown
      gcd}(a,b) = 1$}

Example $\blue -\frac{12}{27}$ is represented by $\blue (-4, 9)$

\bigskip
\pause


{\blue Greatest common divisor ({\redbrown Euclid's algorithm}) }

\begin{tabular}{l|l}\hline
\begin{tabular}{l}
\verb!let rec gcd = function!\\
\verb!  | (0,n) -> n!\\
\verb!  | (m,n) -> gcd(n % m,m);;!\\
\ett{val gcd : int * int -> int}
\end{tabular}
&
\begin{tabular}{l}
{\darkgreen \verb!- gcd(12,27);;!}\\
\ett{\darkgreen val it : int = 3}
\end{tabular}\\ \hline
\end{tabular}

\bigskip
\pause

Function to {\redbrown cancel} common divisors:
{\blue
\begin{alltt}
let canc(p,q) =
   let sign = if p*q < 0 then -1 else 1
   let ap = abs p
   let aq = abs q
   let d  = gcd(ap,aq)
   (sign * (ap / d), aq / d);;

canc(12,-27);;
\ett{val it : int * int = (-4, 9)}
\end{alltt}}
\end{frame}


\begin{frame}[fragile]\frametitle{Program for rational numbers}

Declaration of the constructor: {\blue
\begin{verbatim}
exception QDiv;;
let mkQ = function
   | (_,0)  -> raise QDiv
   | pr     -> canc pr;;
\end{verbatim}
}

\pause

Rules of arithmetic:
\[\darkgreen
\begin{array}{lclclcl}
\frac{a}{b} + \frac{c}{d} & = & \frac{a d + b c}{b d} & \qquad &
\frac{a}{b} - \frac{c}{d} & = & \frac{a d - b c}{b d}\\[1.5mm]
\frac{a}{b} \cdot \frac{c}{d} & = & \frac{a c}{b d} & \qquad &
\frac{a}{b} / \frac{c}{d} & = & \frac{a}{b} \cdot \frac{d}{c}
\quad \mbox{when $c\neq
0$}\\[1.5mm]
\frac{a}{b} = \frac{c}{d} & = & a d = b c & & & &
\end{array}\]

%\medskip
\pause Program corresponds direly to these rules
{\blue
\begin{verbatim}
let (.+.) (a,b) (c,d) = canc(a*d + b*c, b*d);;
let (.-.) (a,b) (c,d) = canc(a*d - b*c, b*d);;
let (.*.) (a,b) (c,d) = canc(a*c, b*d);;
let (./.) (a,b) (c,d) = (a,b) .*. mkQ(d,c);;
let (.=.) (a,b) (c,d) = (a,b) = (c,d);;
\end{verbatim}
}

\begin{center}
Note: Functions must preserve the {\redbrown invariant} of the
representation
\end{center}

\end{frame}


\begin{frame}[fragile]\frametitle{Pattern matching and recursion}

Consider \texttt{\blue unzip} that maps a list of pairs to a
pair of lists:
\label{unzip.fct.page}
\[\blue
\begin{array}{l}
\texttt{unzip([(}x_0,y_0\texttt{);(}x_1,y_1\texttt{);}\ldots\texttt{;(}x_{n-1},y_{n-1}\texttt{)]} \\
\qquad = \texttt{([}x_0\texttt{;}x_1\texttt{;}\ldots\texttt{;}x_{n-1}\texttt{],[}
  y_0\texttt{;}y_1\texttt{;}\ldots\texttt{;}y_{n-1}\texttt{])}
\end{array}
\]
with the declaration:
\begin{alltt}
let rec unzip = function
    | []          -> ([],[])
    | (x,y)::rest ->{\blue let (xs,ys) = unzip rest}
                     (x::xs,y::ys);;

unzip [(1,"a");(2,"b")];;
\ett{val it : int list * string list = ([1; 2], ["a"; "b"])}
\end{alltt}
\pause
Notice
\begin{itemize}
\item pattern matching on result of recursive call
\item \texttt{\blue unzip} is polymorphic. Type?
\item  \texttt{\blue unzip} is available in the \texttt{List} library.
\end{itemize}


\end{frame}

\begin{frame}{Summary}

You are acquainted with a major part of the F\# language.
  \begin{itemize}
  \item Higher-order (or curried) functions

  \item Basic types, equality and ordering

  \item Polymorphism

  \item Tuples

  \item Patterns

  \item A look at lists and list recursion

  \end{itemize}



\end{frame}


\end{document}
