Add case...of slide, rename slides
This commit is contained in:
		
							parent
							
								
									78fe5fc9e9
								
							
						
					
					
						commit
						db789c6643
					
				@ -64,11 +64,15 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
\subsubsection{Pattern matching}
 | 
					\subsubsection{Pattern matching}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
\slide{./content/VL1_functions_and_control_structures2.tex}
 | 
					\slide{./content/VL1_pattern_matching.tex}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					\subsubsection{Case... of}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					\slide{./content/VL1_case_of.tex}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
\subsubsection{Guards and recursion}
 | 
					\subsubsection{Guards and recursion}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
\slide{./content/VL1_functions_and_control_structures3.tex}
 | 
					\slide{./content/VL1_guards_and_recursion.tex}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
\subsection{Lists}
 | 
					\subsection{Lists}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										10
									
								
								VL1/content/VL1_case_of.tex
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								VL1/content/VL1_case_of.tex
									
									
									
									
									
										Normal 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.
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user