Przeglądaj źródła

Improve code prettiness

master
Julian Ospald 9 lat temu
rodzic
commit
29df3d710a
Nie znaleziono w bazie danych klucza dla tego podpisu ID klucza GPG: 220CD1C5BDEED020
3 zmienionych plików z 7 dodań i 7 usunięć
  1. +1
    -1
      VL2/content/VL2_filter2.tex
  2. +3
    -3
      VL2/content/VL2_fold1.tex
  3. +3
    -3
      VL2/content/VL2_map2.tex

+ 1
- 1
VL2/content/VL2_filter2.tex Wyświetl plik

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


+ 3
- 3
VL2/content/VL2_fold1.tex Wyświetl plik

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

+ 3
- 3
VL2/content/VL2_map2.tex Wyświetl plik

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

Ładowanie…
Anuluj
Zapisz