Browse Source

Add case...of slide, rename slides

Julian Ospald 4 years ago
parent
commit
db789c6643
No account linked to committer's email address

+ 6
- 2
VL1/VL1_document_structure.tex View File

@@ -64,11 +64,15 @@
64 64
 
65 65
 \subsubsection{Pattern matching}
66 66
 
67
-\slide{./content/VL1_functions_and_control_structures2.tex}
67
+\slide{./content/VL1_pattern_matching.tex}
68
+
69
+\subsubsection{Case... of}
70
+
71
+\slide{./content/VL1_case_of.tex}
68 72
 
69 73
 \subsubsection{Guards and recursion}
70 74
 
71
-\slide{./content/VL1_functions_and_control_structures3.tex}
75
+\slide{./content/VL1_guards_and_recursion.tex}
72 76
 
73 77
 \subsection{Lists}
74 78
 

+ 10
- 0
VL1/content/VL1_case_of.tex View File

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

VL1/content/VL1_functions_and_control_structures3.tex → VL1/content/VL1_guards_and_recursion.tex View File


VL1/content/VL1_functions_and_control_structures2.tex → VL1/content/VL1_pattern_matching.tex View File