haskell-lectures/VL1/content/VL1_pairs.tex

11 lines
635 B
TeX

\ifger{Ein Tuple zu definieren ist leicht:}{Defining a pair is easy.}
\begin{haskellcode}
p :: (Int, Char) -- this is the type
p = (2, 'y') -- this is how we construct the pair
-- pattern matching against pairs
sumPair :: (Int, Int) -> Int
sumPair (x, y) = x + y
\end{haskellcode}
\pause
\ifger{Hinweis: wir benutzen}{Note: we use} \hinline{(x, y)} \ifger{als Notation sowohl für den Typ als auch die Definition! Dies sind trotzdem 2 verschiedene Dinge. Wir können auch Triple, Quadruple etc. haben.}{notation for both the type and the definition! Those are still two different things. We can also have triples, quadruples etc.}