Blob


1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
2 ;; about the language level of this file in a form that our tools can easily process.
3 #reader(lib "htdp-advanced-reader.ss" "lang")((modname |40.2|) (read-case-sensitive #t) (teachpacks ((lib "guess-gui.ss" "teachpack" "htdp") (lib "guess.ss" "teachpack" "htdp") (lib "gui.ss" "teachpack" "htdp") (lib "draw.ss" "teachpack" "htdp"))) (htdp-settings #(#t constructor repeating-decimal #t #t none #f ((lib "guess-gui.ss" "teachpack" "htdp") (lib "guess.ss" "teachpack" "htdp") (lib "gui.ss" "teachpack" "htdp") (lib "draw.ss" "teachpack" "htdp")))))
4 (define (make-coord x y)
5 (local ((define x0 x)
6 (define y0 y)
7 (define (set-x new-x) (set! x0 new-x))
8 (define (set-y new-y) (set! y0 new-y)))
9 (lambda (op)
10 (op x0 y0 set-x set-y))))
12 (define (coord-x acoord)
13 (acoord (lambda (x1 y1 set-x1 set-y1) x1)))
14 (define (coord-y acoord)
15 (acoord (lambda (x1 y1 set-x1 set-y1) y1)))
16 (define (coord-x! acoord new-x1)
17 (acoord (lambda (x1 y1 set-x1 set-y1) (set-x1 new-x1))))
18 (define (coord-y! acoord new-y1)
19 (acoord (lambda (x1 y1 set-x1 set-y1) (set-y1 new-y1))))
21 (define acoord (make-coord 5 6))
22 (coord-x! acoord 3)
23 (coord-y! acoord 2)
24 (coord-x acoord)
25 (coord-y acoord)