1.5 Examples: Data definitions for mutually referential data
;; A Combo is a structure of Shapes Shapes
(define-struct combo (top bottom))
;; A Shapes is either
;; - a Circle
;; - a Rectangle
;; - a Combo
;; Examples of Shapes
;; remember earlier definitions of cir1, cir2, rect1,and rect2
(define combo1 (make-combo cir1 cir2))
(define combo2 (make-combo rect1 combo1))
(define combo3 (make-combo combo2 rect2))
;; Examples of selectors:
(equal? combo2 (combo-top combo3))
(equal? rect2 (combo-bottom combo3))
(equal? cir1 (combo-top combo1))
(equal? cir2 (combo-bottom combo1))