代写代考 Tree Label Blue Green ListOfTree)

Tree Label Blue Green ListOfTree)
;; Tree is one of:
;; – false
;; – Blue

Copyright By PowCoder代写 加微信 powcoder

;; – Green
;; interp. A very simple tree
;; Label is String
;; interp. a label of a element in a tree
(define-struct blue (lab subs))
;; Blue is (make-blue Label ListOfTree)
;; interp. A Blue tree with a label and a list of sub trees
(define-struct green (lab l r))
;; Green is (make-green Label Tree Tree)
;; interp. A Green tree with a label and two sub trees
;; ListOfTree is one of:
;; – empty
;; – (cons Tree ListOfTree)
;; interp. a list of Trees
(define (fn-for-tree n)
(cond [(false? n) (…)]
[(blue? n) (fn-for-blue n)]
[else (fn-for-green n)]))
(define (fn-for-label l)
(define (fn-for-blue b)
(… (fn-for-label (blue-lab b))
(fn-for-lot (blue-subs
b)))) (define (fn-for-green g)
(… (fn-for-label (green-lab g))
(fn-for-tree (green-l g))
(fn-for-tree (green-r g))))
(define (fn-for-lot lot)
(cond [(empty? lot) (…)]
(… (fn-for-tree (first lot))
(fn-for-lot (rest lot)))]))

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com