projects
/
lambda.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
leafs->leaves
[lambda.git]
/
manipulating_trees_with_monads.mdwn
diff --git
a/manipulating_trees_with_monads.mdwn
b/manipulating_trees_with_monads.mdwn
index
9ae45cc
..
d0897ef
100644
(file)
--- a/
manipulating_trees_with_monads.mdwn
+++ b/
manipulating_trees_with_monads.mdwn
@@
-92,7
+92,7
@@
a reader monad---is to have the treemap function return a (monadized)
tree that is ready to accept any `int -> int` function and produce the
updated tree.
tree that is ready to accept any `int -> int` function and produce the
updated tree.
-\tree (. (. (f
2) (f3))(. (f5) (.(f7)(f
11))))
+\tree (. (. (f
2) (f 3)) (. (f 5) (. (f 7) (f
11))))
\f .
_____|____
\f .
_____|____
@@
-306,7
+306,7
@@
induction on the structure of the first argument that the tree
resulting from `bind u f` is a tree with the same strucure as `u`,
except that each leaf `a` has been replaced with `f a`:
resulting from `bind u f` is a tree with the same strucure as `u`,
except that each leaf `a` has been replaced with `f a`:
-\tree (. (f
a1) (. (. (. (fa2)(fa3)) (fa4)) (f
a5)))
+\tree (. (f
a1) (. (. (. (f a2) (f a3)) (f a4)) (f
a5)))
. .
__|__ __|__
. .
__|__ __|__
@@
-337,8
+337,8
@@
As for the associative law,
we'll give an example that will show how an inductive proof would
proceed. Let `f a = Node (Leaf a, Leaf a)`. Then
we'll give an example that will show how an inductive proof would
proceed. Let `f a = Node (Leaf a, Leaf a)`. Then
-\tree (. (. (. (. (a1)(a2)))))
-\tree (. (. (. (. (a1) (a1)) (. (a1) (a1)))
))
+\tree (. (. (. (. (a1)
(a2)))))
+\tree (. (. (. (. (a1) (a1)) (. (a1) (a1)))))
.
____|____
.
____|____