diff --git a/step_0.rkt b/step_0.rkt new file mode 100644 index 0000000000000000000000000000000000000000..53c0de0a8735e0b242545523e536c442e28d78fd --- /dev/null +++ b/step_0.rkt @@ -0,0 +1,19 @@ +#lang r5rs + +(define (point x y) + (define (dispatch m) + (cond ((eq? m 'getx) x) + ((eq? m 'gety) y) + ((eq? m 'type) 'point) + ((eq? m 'info) (list (dispatch 'type) (dispatch 'getx) (dispatch 'gety) )) + (else (display "ERROR")))) + dispatch) + +(define p (point 1 2)) +(display (p 'getx)) +(newline) +(display (p 'gety)) +(newline) +(display (p 'type)) +(newline) +(display (p 'info))