haskell-lectures/VL2/content/VL2_currying1.tex

13 lines
1.1 KiB
TeX

\ifger{Dies ist, was aus Haskell eine so wunderbare funktionale Sprache macht. In der letzten Vorlesung habe ich bewusst vermieden Funktionen mit mehreren Argumenten zu zeigen. Das liegt daran, dass wir ein bisschen weiter ausholen müssen für das, was jetzt kommt:}{This is what actually makes haskell such a fine functional language. You might have noticed that I tried hard to not show type signatures of functions that have more than one argument. Well, that's because we have to dig a little deeper to explain what comes next:}
\pause
\begin{haskellcode}
addInt :: Int -> Int -> Int
addInt x y = x + y
\end{haskellcode}
\pause
\ifger{Was ist hier passiert? Eher hätte man vermutlich sowas erwartet:}{So, what is happening here? You probably expected something like:}
\begin{haskellcode}
addInt :: (Int, Int) -> Int
addInt (x, y) = x + y
\end{haskellcode}
\ifger{was im Grunde der Sache sogar recht nahe kommt. Denn die Beziehung beider Schreibweisen ist eigentlich schon \textbf{Currying}.}{which is actually pretty close. Because the connection between both syntax is exactly that: \textbf{currying}.}