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