VL1: translate into german
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
And now we can do sanity checks:
|
||||
\ifger{Und jetzt können wir Sicherheitsabfragen machen:}{And now we can do sanity checks:}
|
||||
\begin{haskellcode}
|
||||
calcSomething :: Int -> MaybeInt
|
||||
calcSomething x
|
||||
@@ -6,10 +6,10 @@ calcSomething x
|
||||
| otherwise = Error "Int out of range!"
|
||||
\end{haskellcode}
|
||||
\pause
|
||||
And pattern match on it as well:
|
||||
\ifger{Und darauf \emph{pattern matchen}}{And pattern match on it as well}:
|
||||
\begin{haskellcode}
|
||||
addIntToList :: MaybeInt -> [Int]
|
||||
addIntToList (NoError x) = [x]
|
||||
addIntToList (Error str) = []
|
||||
\end{haskellcode}
|
||||
So if we got an error, we just return an empty list, otherwise we return a list with the \hinline{Int} as its only element.
|
||||
\ifger{D.h. wenn wir hier einen Error bekommen, geben wir einfach eine leere Liste zurück. Ansonsten geben wir die Liste mit dem \hinline{Int} als einziges Element zurück.}{So if we got an error, we just return an empty list, otherwise we return a list with the \hinline{Int} as its only element.}
|
||||
Reference in New Issue
Block a user