@@ 127,35 +128,5 @@ countleaves tb ~~> 6
countleaves tc ~~> 6
Write a function that counts the number of leaves.
+#Write a function that counts the number of leaves.#



[The following should be correct, but won't run in my browser:

let factorial = Y (\fac n. isZero n 1 (mult n (fac (predecessor n)))) in

let reverse =
 Y (\rev l. isNil l nil
 (isNil (tail l) l
 (makeList (head (rev (tail l)))
 (rev (makeList (head l)
 (rev (tail (rev (tail l))))))))) in

reverse (makeList 1 (makeList 2 (makeList 3 nil)))


It may require more resources than my browser is willing to devote to
JavaScript.]

; trees
let t1 = (makeList 1 nil) in
let t2 = (makeList 2 nil) in
let t3 = (makeList 3 nil) in
let t12 = (makeList t1 (makeList t2 nil)) in
let t23 = (makeList t2 (makeList t3 nil)) in
let ta = (makeList t1 t23) in
let tb = (makeList t12 t3) in
let tc = (makeList t1 (makeList t23 nil)) in

2.11.0