Pārlūkot izejas kodu

Add case...of slide, rename slides

master
Julian Ospald pirms 9 gadiem
vecāks
revīzija
db789c6643
Šim parakstam datu bāzē netika atrasta zināma atslēga GPG atslēgas ID: 220CD1C5BDEED020
4 mainītis faili ar 16 papildinājumiem un 2 dzēšanām
  1. +6
    -2
      VL1/VL1_document_structure.tex
  2. +10
    -0
      VL1/content/VL1_case_of.tex
  3. +0
    -0
      VL1/content/VL1_guards_and_recursion.tex
  4. +0
    -0
      VL1/content/VL1_pattern_matching.tex

+ 6
- 2
VL1/VL1_document_structure.tex Parādīt failu

@@ -64,11 +64,15 @@

\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}

\slide{./content/VL1_functions_and_control_structures3.tex}
\slide{./content/VL1_guards_and_recursion.tex}

\subsection{Lists}



+ 10
- 0
VL1/content/VL1_case_of.tex Parādīt failu

@@ -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.

VL1/content/VL1_functions_and_control_structures3.tex → VL1/content/VL1_guards_and_recursion.tex Parādīt failu


VL1/content/VL1_functions_and_control_structures2.tex → VL1/content/VL1_pattern_matching.tex Parādīt failu


Notiek ielāde…
Atcelt
Saglabāt