This preview shows page 1. Sign up to view the full content.
Unformatted text preview: (define-struct interior (left right)) (define-struct leaf (value)) ( (define my-tree (make-interior (make-interior (make-leaf 5) (make-leaf 6)) (make-leaf 2))) (define (tree-sum t) (cond [(leaf? t) (leaf-value t)] [(interior? t) (+ (tree-sum (interior-left t)) (tree-sum (interior-right t)))] ))...
View Full Document
This document was uploaded on 02/12/2010.
- Winter '09