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.
 
 
 

17 lines
1.4 KiB

  1. \ifger{Jetzt wissen wir wie reguläre Funktionen aussehen, z.b.:}{Now you know how a regular function looks like, e.g:}
  2. \begin{haskellcode}
  3. f :: Int -> Int
  4. f x = x + 1
  5. \end{haskellcode}
  6. \ifger{Aber stellen wir uns vor, dass wir eine Hilfsfunktion benötigen, die sehr spezifisch ist und eigentlich zur aktuellen Funktion gehört. In C würden wir diese vermutlich top-level deklarieren und \cinline{static} machen.}{But now imagine we need a helper function which is very specific to the current function. In C we would have to define this new helper function at top-level and would probably make it \cinline{static}.}
  7. \pause
  8. \vspace{\baselineskip}
  9. \\
  10. \ifger{Haskell erlaubt uns hingegen Funktionen \emph{inline} zu definieren, z.b.:}{Haskell allows us to \textbf{inline} functions in a few more ways, e.g.:}
  11. \begin{itemizep}
  12. \item \ifger{über}{with} \hinline{where}
  13. \item \ifger{über}{with} \hinline{let...in}
  14. \item \ifger{anonym (lambda Abstraktion}{anonymously (lambda abstraction)}
  15. \end{itemizep}
  16. \slidep
  17. \ifger{Viele Haskeller mögen es nicht, wenn man nicht-generische Funktionen top-level deklariert. Denn wir können immer noch atomare Funktionsteile haben und diese aber \emph{inline} definieren, sollten sie lediglich einmal benutzte Hilfsfunktionen sein.}{A lot of Haskellers really dislike if you put non-generic functions at the top level. So you can still have atomic pieces, but inline the parts which are very specific to the current function.}