Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

📚 The CoCalc Library - books, templates and other resources

132944 views
License: OTHER
1
mapT :: (t -> s) -> Tree t -> Tree s
2
mapT f (Node x ts) = Node (f x) (map (mapT f) ts)
3
4
reduceT :: (t -> t -> t) -> Tree t -> t
5
reduceT f (Node x ts) = foldl f x (map (reduceT f) ts)
6