about summary refs log tree commit diff stats
path: root/js/games/nluqo.github.io/~bh/61a-pages/Lectures/2.2/print.scm
blob: 23674a73d7ad70b474face677aa968799b9bb574 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
(define (pre-order tree)
  (cond ((null? tree) '())
	(else (print (entry tree))
	      (pre-order (left-branch tree))
	      (pre-order (right-branch tree)) )))

(define (in-order tree)
  (cond ((null? tree) '())
	(else (in-order (left-branch tree))
	      (print (entry tree))
	      (in-order (right-branch tree)) )))

(define (post-order tree)
  (cond ((null? tree) '())
	(else (post-order (left-branch tree))
	      (post-order (right-branch tree))
	      (print (entry tree)) )))