diff --git a/collects/lang/posn.rkt b/collects/lang/posn.rkt index 479b4b85aa..62da65a215 100644 --- a/collects/lang/posn.rkt +++ b/collects/lang/posn.rkt @@ -1,10 +1,15 @@ #lang racket/base +(require lang/private/contracts/contract-syntax) + ;; The posn struct for the teaching languages -(provide (struct-out posn) make-posn) +(provide make-posn posn? posn-x posn-y set-posn-x! set-posn-y! + (rename-out (posn-contract posn))) (struct posn (x y) #:mutable #:transparent) ;; We define a separate function so tha it has the ;; name `make-posn': (define (make-posn x y) (posn x y)) + +(define posn-contract (contract (predicate posn?))) \ No newline at end of file diff --git a/collects/lang/private/beginner-funs.rkt b/collects/lang/private/beginner-funs.rkt index e7ee53b0d8..98489d01b8 100644 --- a/collects/lang/private/beginner-funs.rkt +++ b/collects/lang/private/beginner-funs.rkt @@ -313,6 +313,7 @@ " in a list of pairs")) ("Posns" + (posn contract "contract for posns") (make-posn (number number -> posn) "to construct a posn") (posn? (anything -> boolean) "to determine if its input is a posn") (posn-x (posn -> number) "to extract the x component of a posn")