Fix formatting

This commit is contained in:
Julian Ospald 2015-04-18 16:04:14 +02:00
parent 6a3d66ec14
commit 6e995fc51a
No known key found for this signature in database
GPG Key ID: 220CD1C5BDEED020

17
VL1.tex
View File

@ -135,8 +135,8 @@ Unfortunately, with java we:
\onslide<+->
Some parts of the implicit state machine have been made explicit by modelling classes, but it's still there and we have to deal with it, because we are modelling everything around states. Wouldn't it be nice if we could just forget about the global state machine? Maybe there is even a way to remove side effects and have more "predictability"?
\onslide<+->
\\
\vspace{\baselineskip}
\\
We are lucky. There is. It's called \textbf{Haskell}.
\end{frame}
@ -223,8 +223,9 @@ In haskell expressions are not evaluated until their results are actually needed
\begin{frame}
\frametitle{2.4. What does \textbf{statically typed} mean?}
Every haskell expression has a type and types are always checked at \emph{compile-time}. Programs with errors will not compile and definitely not run.\\
Every haskell expression has a type and types are always checked at \emph{compile-time}. Programs with errors will not compile and definitely not run.
\vspace{\baselineskip}
\\
It is possible to simulate dynamic types however, i.e. types which may be converted to the type you need them in, following rigid rules. In the end, they are still statically type-checked (as in: the compiler always knows what's going on).
\end{frame}
@ -320,8 +321,9 @@ GHCi:
\begin{frame}[fragile]
\frametitle{4.3. Functions and control structures}
Let's make our first function. We want something like the following mathematical function\\
$f(x) = x * x$\\
$f(x) = x * x$
\vspace{\baselineskip}
\\
How could the haskell code look like?
\pause
Almost the same:
@ -329,9 +331,10 @@ Almost the same:
f x = x * x
\end{haskellcode}
\vspace{\baselineskip}
GHCi...\\
GHCi...
\pause
\vspace{\baselineskip}
\\
What is a possible type signature for this function?
\begin{haskellcode}
f :: Int -> Int
@ -351,8 +354,9 @@ isZero 0 = True
isZero x = False
\end{haskellcode}
\vspace{\baselineskip}
So if we pass it 0, we get True. If we do not pass 0, we get False and the value we passed gets basically ignored.\\
So if we pass it 0, we get True. If we do not pass 0, we get False and the value we passed gets basically ignored.
\vspace{\baselineskip}
\\
What might happen if we remove the second or the third line? What is a \textbf{partial function} and a \textbf{total function}?
\end{frame}
@ -446,9 +450,10 @@ Note that \code{(x:(y:zs))} may also be written as \code{(x:y:zs)}.
Haskell also supports \textbf{list comprehension} which is basically syntactic sugar for what we already know from maths.\\
Let's define a set that contains the first ten even natural numbers:\\
\pause
$S = \{2 \times x\ |\ x \in \mathbb{N},\ x \leq 10\}$\\
$S = \{2 \times x\ |\ x \in \mathbb{N},\ x \leq 10\}$
\vspace{\baselineskip}
\pause
\\
How does this look in haskell?
\pause
\begin{haskellcode}