haskell-lectures/VL1/content/VL1_functions_and_control_structures2.tex
Julian Ospald f36590c9f4
Restructure files, make the latex code more modular
Also added a few more section to make beamer and article more
compatible.
2015-04-20 17:38:58 +02:00

13 lines
562 B
TeX

In haskell we often use \textbf{pattern matching}. That means we define a function multiple times, but e.g. for different values of its input arguments. Let's see:
\pause
\begin{haskellcode}
isZero :: Int -> Bool
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.
\vspace{\baselineskip}
\\
\pause
What might happen if we remove the second or the third line? What is a \textbf{partial function} and a \textbf{total function}?