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

View File

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