037-record-predicate.scm (432B)
1 ; Predicates distinguish disjoint record types; rejects non-records too. 2 (define-record-type point (make-point x y) point? (x point-x) (y point-y)) 3 (define-record-type box (make-box w) box? (w box-w)) 4 5 (define p (make-point 1 2)) 6 (define b (make-box 99)) 7 (sys-exit (cond ((point? b) 1) 8 ((box? p) 2) 9 ((point? '()) 3) 10 ((point? p) 22) 11 (else 99)))