haskell-lectures/VL2/content/VL2_currying5.1.tex

10 lines
761 B
TeX

\ifger{Also, wenn wir in Haskell scheinbar mehrere Argumente einer Funktion übergeben, steckt immer Currying dahinter. Es erzeugt eine Reihe von Zwischenfunktionen (oder anonyme Funktionen) mit jeweils einem Argument und evaluiert diese dann schrittweise.}{So, if we seemingly pass multiple arguments into a function, then there is always currying behind it. It creates those intermediate/anonymous functions, all with one argument only, and then evaluates them stepwise.}
\begin{haskellcode}
-- this is more or less just syntax sugar...
f x y z = x + y + z
-- ...for this
f = \x -> (\y -> (\z -> x + y + z)) -- right-associative
\end{haskellcode}
\ifger{Frage: was passiert, wenn wir nur $x = 3$ übergeben?}{Question: what happens if we just pass $x = 3$?}