Add case...of slide, rename slides

This commit is contained in:
Julian Ospald
2015-04-21 18:47:51 +02:00
parent 78fe5fc9e9
commit db789c6643
4 changed files with 16 additions and 2 deletions

View File

@@ -0,0 +1,10 @@
We can also pattern match on the result of a real expression, not just the input. For that, we write:
\begin{haskellcode}
f :: Int -> Bool
f x = case x - 2 of
2 -> True
5 -> True
y -> False
\end{haskellcode}
This allows more powerful pattern matching, especially when we define our own data structures.