X-Git-Url: http://lambda.jimpryor.net/git/gitweb.cgi?p=lambda.git;a=blobdiff_plain;f=implementing_trees.mdwn;h=f3d076e6be3009f32d8e4f78cf689cd09a8310f3;hp=f83823a92d126cfb0ebab4c1fcc718d8b4e696f3;hb=fc7709accbbf8b3ea0d8fc463205fa372a437edd;hpb=4cea4f69242f3a229292186c8fa652942f31f8b8 diff --git a/implementing_trees.mdwn b/implementing_trees.mdwn index f83823a9..f3d076e6 100644 --- a/implementing_trees.mdwn +++ b/implementing_trees.mdwn @@ -1,6 +1,9 @@ #Implementing trees# -In [[Assignment3]] we proposed a very ad-hoc-ish implementation of trees. +In [[Assignment3]] we proposed a very ad-hoc-ish implementation of +trees. It had the virtue of constructing trees entirely out of lists, +which meant that there was no need to define any special +tree-construction functions. Think about how you'd implement them in a more principled way. You could use any of the version 1 -- version 5 implementation of lists as a model. @@ -17,7 +20,7 @@ the tree's leaves that are labeled: / \ 1 2 -Linguists often use trees of this sort. The inner, non-leaf nodes of the +The inner, non-leaf nodes of the tree do have associated values. But what values they are can be determined from the structure of the tree and the values of the node's left and right children. So the inner node doesn't need its own independent label.