2
0
Fork 0
mirror of https://github.com/MartinThoma/LaTeX-examples.git synced 2025-04-25 22:38:04 +02:00
LaTeX-examples/documents/Programmierparadigmen/scripts/haskell/tree-map.hs
2014-03-11 13:58:42 +01:00

5 lines
No EOL
175 B
Haskell

data Tree t = Node t [Tree t]
reduceT :: (t -> t -> t) -> Tree t -> t
reduceT f (Node x []) = x
reduceT f (Node x [y]) = f x y
reduceT f (Node x (y:ys)) = reduceT f (f x y) ys