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.
 
 
 

25 lines
1.1 KiB

  1. \ifger{Und jetzt können wir Funktionen verketten, egal wieviele:}{And now you can chain functions together. Not just two! Look:}
  2. \begin{haskellcode}
  3. f :: String -> Bool
  4. f xs = (even . length . (\x -> x ++ "Hello world")) xs
  5. -- or less ugly
  6. f xs = even . length . (\x -> x ++ "Hello world") $ xs
  7. \end{haskellcode}
  8. % $
  9. \pause
  10. \ifger{Ein anderes Beispiel, bei dem Currying tatsächlich relevant ist:}{Another example where currying is actually important:}
  11. \begin{haskellcode}
  12. f :: Int -> Bool
  13. f x = even . (+) 3 . (-) 4 $ x
  14. -- why not this?
  15. f x = even . (+) 3 . (-) $ 4 x
  16. \end{haskellcode}
  17. %$
  18. \pause
  19. \ifger{Aber es gilt hier einige wichtige Dinge zu beachten:}{So there are a few things that we have to be aware of:}
  20. \begin{itemize}
  21. \item \ifger{die Typen müssen passen!}{the types have to fit!}
  22. \item \ifger{die Arität muss passen!}{the arity has to fit!}
  23. \end{itemize}
  24. \ifger{Das klingt anfangs kompliziert, weil es für die gesamte Verkettung gilt, aber man kommt sehr schnell rein.}{That sounds complicated at first, because it counts for the whole composition chain. But you'll get used to it.}