2
0
Fork 0
mirror of https://github.com/MartinThoma/LaTeX-examples.git synced 2025-04-26 06:48:04 +02:00
LaTeX-examples/documents/Programmierparadigmen/scripts/haskell/mapt.hs
2014-03-25 19:48:20 +01:00

5 lines
No EOL
182 B
Haskell

mapT :: (t -> s) -> Tree t -> Tree s
mapT f (Node x ts) = Node (f x) (map (mapT f) ts)
reduceT :: (t -> t -> t) -> Tree t -> t
reduceT f (Node x ts) = foldl f x (map (reduceT f) ts)