mirror of
https://github.com/MartinThoma/LaTeX-examples.git
synced 2025-04-26 06:48:04 +02:00
5 lines
No EOL
175 B
Haskell
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 |