;; A tree-of-sym is either
;; - empty
;; - (make-tree sym tree-of-sym tree-of-sym)
(define-struct tree (val left right))
Implement count-syms : tree-of-sym -> num
Define tree-of-X
Implement count : tree-of-X -> num
Implement contains-sym? : sym tree-of-sym -> bool,
which reports whether the given symbol is in the tree.
Implement contains-num? : num tree-of-num -> bool,
which reports whether the given number is in the tree.
Abstract to contains? : X tree-of-X -> bool,
if you haven’t already.
Write tree-map : (X -> Y) tree-of-X -> tree-of-Y.
Implement tree-add : num tree-of-num -> tree-of-num,
which creates a tree like the given one, but with every
number in the tree increased by the given amount.
Implement apple-tree : tree-of-sym -> tree-of-num,
which creates a tree like the given one, but every 'apple
is replaced by 100 and all other symbols are replaced
by 0.
Last update: Wednesday, October 20th, 2010mflatt@cs.utah.edu