X-Git-Url: http://lambda.jimpryor.net/git/gitweb.cgi?p=lambda.git;a=blobdiff_plain;f=manipulating_trees_with_monads.mdwn;h=d4b0bd877001f2d7a1e4c558e0ed16622fe55eaf;hp=1be499b023d19ea5b1da89c5ccb18002a3b5e1b9;hb=f5b1ef726e2cfa444df2b5fc50562822a90f0b03;hpb=a562d1d1ef9f380ddbe6e5f72aad3d4bfeaba716;ds=sidebyside diff --git a/manipulating_trees_with_monads.mdwn b/manipulating_trees_with_monads.mdwn index 1be499b0..d4b0bd87 100644 --- a/manipulating_trees_with_monads.mdwn +++ b/manipulating_trees_with_monads.mdwn @@ -1,10 +1,9 @@ [[!toc]] - Manipulating trees with monads ------------------------------ -This thread develops an idea based on a detailed suggestion of Ken +This topic develops an idea based on a detailed suggestion of Ken Shan's. We'll build a series of functions that operate on trees, doing various things, including replacing leaves, counting nodes, and converting a tree to a list of leaves. The end result will be an @@ -12,11 +11,11 @@ application for continuations. From an engineering standpoint, we'll build a tree transformer that deals in monads. We can modify the behavior of the system by swapping -one monad for another. (We've already seen how adding a monad can add +one monad for another. We've already seen how adding a monad can add a layer of funtionality without disturbing the underlying system, for instance, in the way that the reader monad allowed us to add a layer of intensionality to an extensional grammar, but we have not yet seen -the utility of replacing one monad with other.) +the utility of replacing one monad with other. First, we'll be needing a lot of trees during the remainder of the course. Here's a type constructor for binary trees: