Write the fern template and the list-of-ferns template.

Solution

;; fern-template : fern -> ???
(define (fern-template a-fern)
  (cond
    [(leaf? a-fern) 
     ... (leaf-area a-fern) ...]
    [(branch? a-fern) 
     ... (branch-length a-fern) ...
     ... (branch-thickness a-fern) ...
     ... (list-of-fern-template (branch-left a-fern)) ...
     ... (list-of-fern-template (branch-right a-fern)) ...]))
     
;; list-of-fern-template : list-of-fern -> ???
(define (list-of-fern-template a-lof)
  (cond
   [(empty? a-lof) ...]
   [(cons? a-lof) 
    ... (fern-template (first a-lof)) ...
    ... (list-of-fern-template (rest a-lof)) ...]))