added or/c as alias for union
svn: r2059
This commit is contained in:
parent
55e361dad4
commit
c43a6f2821
|
@ -675,7 +675,7 @@ add struct contracts for immutable structs?
|
||||||
(provide anaphoric-contracts
|
(provide anaphoric-contracts
|
||||||
flat-rec-contract
|
flat-rec-contract
|
||||||
flat-murec-contract
|
flat-murec-contract
|
||||||
union
|
or/c union
|
||||||
not/c
|
not/c
|
||||||
=/c >=/c <=/c </c >/c
|
=/c >=/c <=/c </c >/c
|
||||||
integer-in
|
integer-in
|
||||||
|
@ -769,7 +769,24 @@ add struct contracts for immutable structs?
|
||||||
(lambda (v)
|
(lambda (v)
|
||||||
(hash-table-get ht v (lambda () #f))))))
|
(hash-table-get ht v (lambda () #f))))))
|
||||||
|
|
||||||
(define (union . args)
|
(define-syntax (union stx)
|
||||||
|
(begin
|
||||||
|
#;
|
||||||
|
(fprintf (current-error-port)
|
||||||
|
"WARNING: union is deprecated, use or/c (file ~a~a)\n"
|
||||||
|
(let ([file (syntax-source stx)])
|
||||||
|
(if (path? file)
|
||||||
|
(path->string file)
|
||||||
|
(format "~s" file)))
|
||||||
|
(let ([line (syntax-line stx)])
|
||||||
|
(if (number? line)
|
||||||
|
(format ", line ~a" line)
|
||||||
|
"")))
|
||||||
|
(syntax-case stx ()
|
||||||
|
[(_ args ...) (syntax (or/c args ...))]
|
||||||
|
[id (syntax or/c)])))
|
||||||
|
|
||||||
|
(define (or/c . args)
|
||||||
(for-each
|
(for-each
|
||||||
(lambda (x)
|
(lambda (x)
|
||||||
(unless (or (contract? x)
|
(unless (or (contract? x)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user