From d46bf9ad6b6516143bbe3dc00acff08b70b6dbd3 Mon Sep 17 00:00:00 2001 From: Jim Pryor Date: Sun, 3 Oct 2010 04:04:47 -0400 Subject: [PATCH] tweak advanced Signed-off-by: Jim Pryor --- miscellaneous_lambda_challenges_and_advanced_topics.mdwn | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/miscellaneous_lambda_challenges_and_advanced_topics.mdwn b/miscellaneous_lambda_challenges_and_advanced_topics.mdwn index 173ddbe3..c706ec18 100644 --- a/miscellaneous_lambda_challenges_and_advanced_topics.mdwn +++ b/miscellaneous_lambda_challenges_and_advanced_topics.mdwn @@ -548,19 +548,19 @@ So the inner node doesn't need its own independent label. Similarly, the leaf-labeled tree: - + + . / \ - + 3 + . 3 / \ 1 2 can be thought of as a data structure of the form: - Node (its_left_subtree, its_right_subtree) | Leaf (its_label) + Leaf (its_label) | Non_leaf (its_left_subtree, its_right_subtree) and that could be implemented in v2 form as: - the_tree (\left right. node_handler) (\label. lead_handler) + the_tree (\left right. non_leaf_handler) (\label. leaf_handler) And the node-labeled tree: @@ -574,11 +574,11 @@ So the inner node doesn't need its own independent label. can be thought of as a data structure of the form: - Node (its_left_subtree, its_label, its_right_subtree) | Leaf + Leaf | Non_leaf (its_left_subtree, its_label, its_right_subtree) and that could be implemented in v2 form as: - the_tree (\left label right. node_handler) leaf_result + the_tree (\left label right. non_leaf_handler) leaf_result What would correspond to "folding" a function `f` and base value `z` over a @@ -607,7 +607,7 @@ So the inner node doesn't need its own independent label. the label of the root (topmost node) of a tree; extracting the left subtree of a node; and so on. - Think about different ways you might implement v3-style trees. + Think about different ways you might implement leaf-labeled trees. If you had one tree and wanted to make a larger tree out of it, adding in a new element, how would you do that? @@ -678,7 +678,7 @@ the tree to be relatively "balanced", like this: you're building pretty "balanced" in this way? This is a large topic in computer science. There's no need for you to learn -any of the various strategies that they've developed for doing this. But +the various strategies that they've developed for doing this. But thinking in broad brush-strokes about what strategies might be promising will help strengthen your understanding of trees, and useful ways to implement them in a purely functional setting like the lambda calculus. -- 2.11.0