2015-04-23 19:34:47 +00:00
|
|
|
\ifger{Lösung:}{Solution:}
|
2015-04-19 22:32:50 +00:00
|
|
|
\begin{haskellcode}
|
|
|
|
addTwo :: [Int] -> [Int]
|
|
|
|
addTwo [] = []
|
|
|
|
addTwo (x:xs) = (x + 2) : addTwo xs
|
|
|
|
\end{haskellcode}
|
|
|
|
\pause
|
2015-04-23 19:34:47 +00:00
|
|
|
\ifger{Jetzt wollen wir jedes Element quadrieren:}{Now we want to square every element:}
|
2015-04-19 22:32:50 +00:00
|
|
|
\pause
|
|
|
|
\begin{haskellcode}
|
|
|
|
square :: [Int] -> [Int]
|
|
|
|
square [] = []
|
|
|
|
square (x:xs) = (x * x) : square xs
|
|
|
|
\end{haskellcode}
|
|
|
|
\pause
|
2015-04-23 19:34:47 +00:00
|
|
|
\ifger{Jetzt wollen wir den Betrag jedes Elements:}{Now we want the absolute of every element:}
|
2015-04-19 22:32:50 +00:00
|
|
|
\begin{haskellcode}
|
|
|
|
absList :: [Int] -> [Int]
|
|
|
|
absList [] = []
|
|
|
|
absList (x:xs) = (abs x) : absList xs
|
|
|
|
\end{haskellcode}
|
|
|
|
\pause
|
2015-04-23 19:34:47 +00:00
|
|
|
\ifger{Fällt etwas auf?}{Do you notice something?}
|