Improve code prettiness

This commit is contained in:
Julian Ospald 2015-05-01 16:42:06 +02:00
parent ca934d2391
commit 29df3d710a
No known key found for this signature in database
GPG Key ID: 220CD1C5BDEED020
3 changed files with 7 additions and 7 deletions

View File

@ -6,7 +6,7 @@ filter :: (a -> Bool) -> [a] -> [a]
\pause
\begin{haskellcode}
filter :: (a -> Bool) -> [a] -> [a]
filter f [] = []
filter f [] = []
filter f (x:xs)
| f x = x : filter f xs
| otherwise = filter f xs

View File

@ -6,20 +6,20 @@ sum :: [Int] -> Int
\pause
\begin{haskellcode}
sum :: [Int] -> Int
sum [] = 0
sum [] = 0
sum (x:xs) = x + sum xs
\end{haskellcode}
\pause
\ifger{Oder das Produkt:}{Or the product:}
\begin{haskellcode}
prod :: [Int] -> Int
prod [] = 1
prod [] = 1
prod (x:xs) = x * prod xs
\end{haskellcode}
\pause
\ifger{Oder die Länge:}{Or the length:}
\begin{haskellcode}
length :: [a] -> Int
length [] = 0
length [] = 0
length (x:xs) = 1 + length xs
\end{haskellcode}

View File

@ -1,7 +1,7 @@
\ifger{Lösung:}{Solution:}
\begin{haskellcode}
addTwo :: [Int] -> [Int]
addTwo [] = []
addTwo [] = []
addTwo (x:xs) = (x + 2) : addTwo xs
\end{haskellcode}
\pause
@ -9,14 +9,14 @@ addTwo (x:xs) = (x + 2) : addTwo xs
\pause
\begin{haskellcode}
square :: [Int] -> [Int]
square [] = []
square [] = []
square (x:xs) = (x * x) : square xs
\end{haskellcode}
\pause
\ifger{Jetzt wollen wir den Betrag jedes Elements:}{Now we want the absolute of every element:}
\begin{haskellcode}
absList :: [Int] -> [Int]
absList [] = []
absList [] = []
absList (x:xs) = (abs x) : absList xs
\end{haskellcode}
\pause