Switch from except' (from racket/unit') to #:except' in 2htdp/private'.

This is used by the `function-with-arity' macro, and the use of `except'
looks like something that is better done with a keyword.  I think that
this change should be fine since it's a private function.
This commit is contained in:
Eli Barzilay 2012-11-06 13:28:27 -05:00
parent 5aca765989
commit 95679bdab5
2 changed files with 15 additions and 16 deletions

View File

@ -3,7 +3,7 @@
;; --------------------------------------------------------------------------------------------------- ;; ---------------------------------------------------------------------------------------------------
;; provides functions for specifying the shape of big-bang and universe clauses: ;; provides functions for specifying the shape of big-bang and universe clauses:
(provide function-with-arity expr-with-check except err) (provide function-with-arity expr-with-check err)
;; ... and for checking and processing them ;; ... and for checking and processing them
@ -15,7 +15,6 @@
(require racket/function (require racket/function
racket/list racket/list
racket/bool racket/bool
(only-in racket/unit except) ; used only as a keyword...?
(for-syntax racket/base syntax/parse) (for-syntax racket/base syntax/parse)
(for-template "clauses-spec-aux.rkt" (for-template "clauses-spec-aux.rkt"
racket racket
@ -33,15 +32,15 @@
[(_ x) #`(check> #,tag x)] [(_ x) #`(check> #,tag x)]
[_ (err tag p msg)])))])) [_ (err tag p msg)])))]))
(define-syntax function-with-arity (define-syntax function-with-arity
(syntax-rules (except) (syntax-rules ()
[(_ arity) [(_ arity)
(lambda (tag) (lambda (tag)
(lambda (p) (lambda (p)
(syntax-case p () (syntax-case p ()
[(_ x) #`(proc> #,tag (f2h x) arity)] [(_ x) #`(proc> #,tag (f2h x) arity)]
[_ (err tag p)])))] [_ (err tag p)])))]
[(_ arity except extra ...) [(_ arity #:except extra ...)
(lambda (tag) (lambda (tag)
(lambda (p) (lambda (p)
(syntax-case p () (syntax-case p ()

View File

@ -56,15 +56,15 @@
;; it may specify a clock-tick rate ;; it may specify a clock-tick rate
[on-tick DEFAULT #'#f [on-tick DEFAULT #'#f
(function-with-arity (function-with-arity
1 1
except #:except
[(_ f rate) [(_ f rate)
#'(list #'(list
(proc> 'on-tick (f2h f) 1) (proc> 'on-tick (f2h f) 1)
(num> 'on-tick rate (lambda (x) (and (real? x) (positive? x))) (num> 'on-tick rate (lambda (x) (and (real? x) (positive? x)))
"positive number" "rate"))] "positive number" "rate"))]
[(_ f rate limit) [(_ f rate limit)
#'(list #'(list
(proc> 'on-tick (f2h f) 1) (proc> 'on-tick (f2h f) 1)
(num> 'on-tick rate (lambda (x) (and (real? x) (positive? x))) (num> 'on-tick rate (lambda (x) (and (real? x) (positive? x)))
"positive number" "rate") "positive number" "rate")
@ -82,11 +82,11 @@
;; on-draw must specify a rendering function; ;; on-draw must specify a rendering function;
;; it may specify dimensions ;; it may specify dimensions
[on-draw to-draw DEFAULT #'#f [on-draw to-draw DEFAULT #'#f
(function-with-arity (function-with-arity
1 1
except #:except
[(_ f width height) [(_ f width height)
#'(list (proc> 'to-draw (f2h f) 1) #'(list (proc> 'to-draw (f2h f) 1)
(nat> 'to-draw width "width") (nat> 'to-draw width "width")
(nat> 'to-draw height "height"))])] (nat> 'to-draw height "height"))])]
;; World Nat Nat MouseEvent -> World ;; World Nat Nat MouseEvent -> World
@ -107,9 +107,9 @@
;; World -> Boolean ;; World -> Boolean
;; -- stop-when must specify a predicate; it may specify a rendering function ;; -- stop-when must specify a predicate; it may specify a rendering function
[stop-when DEFAULT #'False [stop-when DEFAULT #'False
(function-with-arity (function-with-arity
1 1
except #:except
[(_ stop? last-picture) [(_ stop? last-picture)
#'(list (proc> 'stop-when (f2h stop?) 1) #'(list (proc> 'stop-when (f2h stop?) 1)
(proc> 'stop-when (f2h last-picture) 1))])] (proc> 'stop-when (f2h last-picture) 1))])]