CS 1410-20 Lab 5

  ;; A tree-of-sym is either
  ;; - empty
  ;; - (make-tree sym tree-of-sym tree-of-sym)
  (define-struct tree (val left right))
  1. Implement count-syms : tree-of-sym -> num
  2. Define tree-of-X
  3. Implement count : tree-of-X -> num
  4. Implement contains-sym? : sym tree-of-sym -> bool, which reports whether the given symbol is in the tree.
  5. Implement contains-num? : num tree-of-num -> bool, which reports whether the given number is in the tree.
  6. Abstract to contains? : X tree-of-X -> bool, if you haven’t already.
  7. Write tree-map : (X -> Y) tree-of-X -> tree-of-Y.
  8. 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.
  9. 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, 2010
mflatt@cs.utah.edu