Browse Source

Improve function composition slides

stripped-german
Julian Ospald 9 years ago
parent
commit
ca0f732f08
No known key found for this signature in database GPG Key ID: 220CD1C5BDEED020
1 changed files with 9 additions and 0 deletions
  1. +9
    -0
      VL2.tex

+ 9
- 0
VL2.tex View File

@@ -366,6 +366,15 @@ Solution:
(.) :: (b -> c) -> (a -> b) -> a -> c
(.) f g x = f (g x)
\end{haskellcode}
\pause
And now you can chain functions together. Not just two! Look:
\begin{haskellcode}
f :: String -> Bool
f xs = (even . length . (\x -> x ++ "Hello world")) xs
-- or less ugly
f xs = even . length . (\x -> x ++ "Hello world") $ xs
\end{haskellcode}
% $
\end{frame}

\section{6. Recursion patterns}


Loading…
Cancel
Save