...
Code Block |
---|
;; Given (define-struct add (left right)) (define-struct sub (left right)) (define-struct mul (left right)) (define-struct div (left right)) ;; an Arithmetic-Expression (AExp) is either: ;; - a number ; ;; - (make-add l r) where l,r are AExps; ;; - (make-sub l r) where l,r are AExps; ;; - (make-mul l r) where l,r are AExps; or ;; - (make-div l r) where l,r are AExps, ;; Remember that the define-struct function also automatically defines comparisonstucture recognizer functions:, e.g. ;; add?, sub?, mul? and div? ;; Note: the structure recognizer function, number?, can be used to test if a value is a number. |
...