Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

📚 The CoCalc Library - books, templates and other resources

132937 views
License: OTHER
1
data Tree t = Node t [Tree t]
2
reduceT :: (t -> t -> t) -> Tree t -> t
3
reduceT f (Node x []) = x
4
reduceT f (Node x [y]) = f x y
5
reduceT f (Node x (y:ys)) = reduceT f (f x y) ys
6