You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

16 lines
914 B

  1. \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.}
  2. \begin{haskellcode}
  3. -- this is more or less just syntax sugar...
  4. f x y z = x + y + z
  5. -- ...for this
  6. f = \x -> (\y -> (\z -> x + y + z)) -- right-associative
  7. \end{haskellcode}
  8. \ifger{Frage: was passiert, wenn wir nur $x = 3$ übergeben?}{Question: what happens if we just pass $x = 3$?}
  9. \vspace{\baselineskip}
  10. \\
  11. \pause
  12. \ifger{Wieso nicht das?}{Why not this?}
  13. \begin{haskellcode}
  14. f = \x -> x + (\y -> y + (\z -> z)) -- no!
  15. \end{haskellcode}