whoops, tree_best_sofar (direct) had a bug
[lambda.git] / exercises / assignment5_answers.mdwn
index 0005ec6..1780b0a 100644 (file)
@@ -263,7 +263,7 @@ Choose one of these languages and write the following functions.
 
         let rec tree_best_sofar (t : 'a color_tree) (lead : maybe_leader) : maybe_leader * int =
           match t with
-          | Leaf a -> (None, a)
+          | Leaf a -> (lead, a)
           | Branch(l, col, r) ->
               let (lead',left_score) = tree_best_sofar l lead in
               let (lead'',right_score) = tree_best_sofar r lead' in
@@ -437,6 +437,7 @@ Again, we've left some gaps. (The use of `type` for the first line in Haskell an
         type lambda_term = Var of identifier | Abstract of identifier * lambda_term | App of lambda_term * lambda_term
 
 <a id="occurs_free"></a>
+
 16. Write a function `occurs_free` that has the following type:
 
         occurs_free : identifier -> lambda_term -> bool