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.0 KiB

  1. \ifger{Wieso haben wir uns so lange mit Currying aufgehalten? Nun, es ist wie gesagt sehr wichtig für \emph{Funktionskomposition}. Sie zählt ebenfalls zu den fundamentalen Basiskonzepten der funktionalen Programmierung.}{So why did we just bother so long with explaining currying? It's because it's very important for \emph{function composition}. Which again is also one of the fundamental concepts of functional programming.}
  2. \vspace{\baselineskip}
  3. \\
  4. \ifger{Aus der Mathematik wissen wir bereits, dass:}{From maths we already know that:}\\
  5. $(f \circ g)(x) = f(g(x))$
  6. \vspace{\baselineskip}
  7. \\
  8. \pause
  9. \ifger{Und das ist praktisch schon alles. Wir machen dasselbe in Haskell:}{And that's basically it. We do the same in haskell, it looks like this:}
  10. \begin{haskellcode}
  11. composedFunction x = (f . g) x
  12. -- same as above... everything on the right side of $
  13. -- is evaluated first
  14. composedFunction x = f . g $ x
  15. -- and same again, remember that 'g x ='
  16. -- is just syntax sugar
  17. -- omitting the x here is also called eta reduction
  18. composedFunction = f . g
  19. \end{haskellcode}