From 5b055e3d14fb38977001a787df550795d4b3ad36 Mon Sep 17 00:00:00 2001 From: Chris Barker Date: Mon, 4 Oct 2010 11:50:04 -0400 Subject: [PATCH] edits --- assignment4.mdwn | 10 +++++++--- implementing_trees.mdwn | 7 +++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/assignment4.mdwn b/assignment4.mdwn index 12c1ef2a..6a528a23 100644 --- a/assignment4.mdwn +++ b/assignment4.mdwn @@ -64,10 +64,14 @@ return later in the term to the problem of determining when two trees have the same fringe. For now, one straightforward way to determine this would be: enumerate the fringe of the first tree. That gives you a list. Enumerate the fringe of the second tree. That also gives you a list. Then compare the two -lists to see if they're equal. (You just programmed this above.) +lists to see if they're equal. + +Write the fringe-enumeration function. It should work on the +implementation of trees you designed in the previous step, and it +should make use of the list comparison function you wrote for question +2. Thus you'll have to make sure you only use Church numerals as the +labels of your leaves, though nothing enforces this self-discipline. -Write the fringe-enumeration function. It should work on the implementation of -trees you designed in the previous step. 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. -- 2.11.0