|
|
@@ -7,13 +7,8 @@ addInt x y = x + y |
|
|
|
addTwo :: Int -> Int |
|
|
|
addTwo = addInt 2 |
|
|
|
\end{haskellcode} |
|
|
|
\ifger{Warum haben wir nicht \hinline{addTwo x = ...} geschrieben? Wieso sollten wir? Wir haben \hinline{addInt} ein Argument übergeben, also ist die Arität (im Beispiel vorher Dimension) einer weniger und damit ist noch ein Argument notwendig um den endgültigen Wert zu bekommen.}{You probably noticed that we did not write \hinline{addTwo x = ...}, but why would we? We gave \hinline{addInt} one argument, so the arity (we called it dimension in the gemoetrical example) is one less, but there is still one parameter left we can pass in.} |
|
|
|
\pause |
|
|
|
\ifger{Der Grund warum wir \hinline{x} auslassen können ist, dass}{The reason we can omit the \hinline{x} here is that} |
|
|
|
\begin{haskellcode} |
|
|
|
f x y z = ... |
|
|
|
\end{haskellcode} |
|
|
|
\ifger{nur syntax sugar ist für}{is just syntax sugar for} |
|
|
|
\begin{haskellcode} |
|
|
|
f = \x -> (\y -> (\z -> ... )) -- right-associative, ofc |
|
|
|
\end{haskellcode} |
|
|
|
\ifger{Warum haben wir nicht \hinline{addTwo x = ...} geschrieben? Wieso sollten wir? Wir haben \hinline{addInt} ein Argument übergeben, also ist die Arität (im Beispiel vorher Dimension) einer weniger und damit ist noch ein Argument notwendig um den endgültigen Wert zu bekommen. |
|
|
|
\vspace{\baselineskip}\\ |
|
|
|
Oder in anderen Worten: wir haben der Zwischenfunktion, die Currying für uns erstellt hat, lediglich den Namen \hinline{addTwo} gegeben.}{You probably noticed that we did not write \hinline{addTwo x = ...}, but why would we? We gave \hinline{addInt} one argument, so the arity (we called it dimension in the gemoetrical example) is one less, but there is still one parameter left we can pass in. |
|
|
|
\vspace{\baselineskip}\\ |
|
|
|
Or in other words: we just gave the intermediate function that currying created for us the name \hinline{addTwo}. That's it.}\vspace{\baselineskip}\\ |