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.
 
 
 

21 lines
1.4 KiB

  1. \ifger{D.h. mathematisch gesehen können wir schreiben:}{So in mathematical terms you can say:}\\
  2. $f : A_1 \times ... \times A_n \mapsto B$
  3. \\
  4. \ifger{wird zu}{gets modified into:}\\
  5. \pause
  6. $f' : A_1 \mapsto (A_2 \mapsto (\ ...\ (A_n \mapsto B)))$
  7. \vspace{\baselineskip}
  8. \\
  9. \pause
  10. \ifger{Die Klammern hier sind äußerst wichtig! Currying ist \emph{rechts}-assoziativ, d.h. die folgenden 2 Typsignaturen sind äquivalent:}{The braces are \textbf{very} important! It means currying is \emph{right}-associative and these these two signatures are equivalent:}
  11. \begin{haskellcode}
  12. f :: Int -> Int -> Int
  13. f :: Int -> (Int -> Int)
  14. -- but this is NOT the same
  15. f :: (Int -> Int) -> Int
  16. \end{haskellcode}
  17. \ifger{Auf der anderen Seite ist Funktionsanwendung \emph{links}-assoziativ, d.h.}{On the other hand function application is \emph{left}-associative, so} \hinline{f 3 2} \ifger{ist nur die Kurzform für}{is just a shorthand of} \hinline{(f 3) 2}.
  18. \vspace{\baselineskip}
  19. \\
  20. \ifger{Also, wenn wir in Haskell scheinbar mehrere Argumente einer Funktion übergeben, steckt immer Currying dahinter. Es erzeugt eine Reihe von (Zwischen-)Funktionen mit jeweils einem Argument und evaluiert diese dann schrittweise.}{So, if we seemingly pass multiple arguments into a function, then that's always currying in disguise. It create those (intermediate) functions, all with one argument only, and then evaluates them stepwise.}