|
|
|
@ -12,14 +12,14 @@
|
|
|
|
|
;; order of cases matters, of course
|
|
|
|
|
;; match more complicated shape first,
|
|
|
|
|
;; otherwise second matcher gives false positives
|
|
|
|
|
[(_ (name arg ...) body ...)
|
|
|
|
|
[(_ (name arg ... . rest-arg) body ...)
|
|
|
|
|
#'(begin
|
|
|
|
|
(provide name)
|
|
|
|
|
(define (name arg ...) body ...))]
|
|
|
|
|
[(_ (name . arg) body ...)
|
|
|
|
|
(define (name arg ... . rest-arg) body ...))]
|
|
|
|
|
[(_ (name arg ...) body ...)
|
|
|
|
|
#'(begin
|
|
|
|
|
(provide name)
|
|
|
|
|
(define (name . arg) body ...))]
|
|
|
|
|
(define (name arg ...) body ...))]
|
|
|
|
|
[(_ name body ...)
|
|
|
|
|
#'(begin
|
|
|
|
|
(provide name)
|
|
|
|
@ -28,19 +28,18 @@
|
|
|
|
|
|
|
|
|
|
(define-syntax (define/provide/contract stx)
|
|
|
|
|
(syntax-case stx ()
|
|
|
|
|
[(_ (name arg ...) contract body ...)
|
|
|
|
|
[(_ (name arg ... . rest-arg) contract body ...)
|
|
|
|
|
#'(begin
|
|
|
|
|
(provide (contract-out [name contract]))
|
|
|
|
|
(define (name arg ...) body ...))]
|
|
|
|
|
[(_ (name . arg) contract body ...)
|
|
|
|
|
(define (name arg ... . rest-arg) body ...))]
|
|
|
|
|
[(_ (name arg ...) contract body ...)
|
|
|
|
|
#'(begin
|
|
|
|
|
(provide (contract-out [name contract]))
|
|
|
|
|
(define (name . arg) body ...))]
|
|
|
|
|
(define (name arg ...) body ...))]
|
|
|
|
|
[(_ name contract body ...)
|
|
|
|
|
#'(begin
|
|
|
|
|
(provide (contract-out [name contract]))
|
|
|
|
|
(define name body ...))]))
|
|
|
|
|
|
|
|
|
|
(define/provide/contract (foo #:what x)
|
|
|
|
|
(#:what integer? . -> . integer?)
|
|
|
|
|
(λ(x) x))
|
|
|
|
|
(define/provide (foo x y . z)
|
|
|
|
|
(+ x y z))
|