anchor.diff:              d
               (loop (compute-by-function (car nodes) f-type d) (cdr nodes))))))
   
  -  (let ((call-data (compute-by-function call-tree f-type '())))
  -    (format #t "~12A | ~5@A | ~10@A~%" "Function" "count" "time (nS)")
  -    (format #t "-------------+-------+-----------~%")
  +  (let ((call-data (let loop ((trees call-trees)
  +                              (data '()))
  +                     (if (nil? trees)
  +                         data
  +                         (loop (cdr trees) (compute-by-function (car trees) f-type data))))))
  +    (format #t "~20A | ~5@A | ~10@A | ~10A~%" "Function" "count" "total time" "avg time")
  +    (format #t "---------------------+-------+------------+-----------~%")
       (for-each (lambda (d)
  -                (format #t "~12A | ~5@A | ~10@A~%" (car d) (cadr d) (caddr d)))
  -              call-data)))
  +                (let ((name (car d))
  +                      (count (cadr d))
  +                      (time (caddr d)))
  +                  (format #t "~20A | ~5@A | ~10@A | ~10A~%" name count time (/ time count))))
  +              call-data)
  +    (format #t "---------------------+-------+------------+-----------~%")))
   
   
   (define (print-tree)
  
positive.code: ;;; license that can be found in the LICENSE file.
  
  (define time first)
  (define mode second)
  (define type third)
  (define name fourth)
  
  (define node-time first)
  (define node-type second)
  (define node-name third)
  (define node-children fourth)
  
  (define call-tree nil)
  
  (define (read-function-call start-data f)
    (let* ((start-time (time start-data))
           (f-type (type start-data))
           (f-name (name start-data))
           (children-end (let loop
                             ((d (read f))
                              (ch '()))
                           (cond ((and (eq? (mode d) 'exit)
                                       (eq? (name d) f-name))
                                  (list (time d) ch))
                                 ((eq? (mode d) 'enter)
                                  (let ((children (cons (read-function-call d f) ch))) 
                                    (loop (read f) children))))))
           (end-time (car children-end))
           (children (cadr children-end)))
      (list (- end-time start-time) f-type f-name children)))
  
  
  (define (load-profile filename)
    (let* ((f (open-input-file filename)))
      (set! call-tree (read-function-call (read f) f))
      (close-port f)))
  
  
  (define (add-to-function fname time data)
    (let ((existing (assoc fname data)))
      (if (null? existing)
          (acons fname (list 1 time) data)
          (acons fname (list (+ (cadr existing) 1) (+ time (caddr existing))) (dissoc fname data)))))
  
  
  ;;; type can be prim, func, or all
  (define (by-function f-type)
    (define (compute-by-function tree f-type data) 
      (let ((new-data (if (or (eq? f-type 'all)
                              (eq? f-type (node-type tree)))
                          (add-to-function (node-name tree) (node-time tree) data)
                          data)))
        (let loop
            ((d new-data)
             (nodes (node-children tree)))
  
negative.code:                 (inner-print-tree n (+ level 1)))
                (node-children node)))
  
    (for-each (lambda (tree)
                (inner-print-tree tree 0)
                (newline))
              call-trees))
  