haskell-lectures/VL2/content/VL2_currying3.tex

18 lines
515 B
TeX
Raw Normal View History

Maybe a mathematical example will make things clearer. Let's say we have the function:\\
$f(x, y) = y / x$
\vspace{\baselineskip}
\\
\pause
In order to evaluate the function for $x = 2$ and $y = 3$ we would do:\\
$f(2, 3) = 2 / 3$\\
and be done.
\vspace{\baselineskip}
\\
\pause
However, how about we just put in x first and make a new function. Since x is gone, we can write:\\
$g(y) = f(2, y) = y / 2$
\vspace{\baselineskip}
\\
\pause
And in a second step we solve the function $g(y)$:\\
$g(3) = f (2, 3) = 3 / 2$