Some selective #:when (not ...)' -> #:unless ...'.

This commit is contained in:
Eli Barzilay 2011-09-14 16:53:45 -04:00
parent 55a8471838
commit 623c7493ed
14 changed files with 19 additions and 25 deletions

View File

@ -307,7 +307,7 @@
[else (error 'zo-parse "bad phase ~a body element: ~e" i sb)])))) [else (error 'zo-parse "bad phase ~a body element: ~e" i sb)]))))
;; unexported: ;; unexported:
(for/list ([l (in-list phase-data)] (for/list ([l (in-list phase-data)]
#:when (not (void? (list-ref l 1)))) #:unless (void? (list-ref l 1)))
(let* ([phase (list-ref l 0)] (let* ([phase (list-ref l 0)]
[indirect-syntax [indirect-syntax
;; could check: (list-ref l 2) should be size of vector: ;; could check: (list-ref l 2) should be size of vector:

View File

@ -122,8 +122,8 @@
(define (sub get-edges get-node get-node-time) (define (sub get-edges get-node get-node-time)
(for*/list ([edge (in-list (get-edges node))] (for*/list ([edge (in-list (get-edges node))]
[sub (in-list (list (get-node edge)))] ; <-- hack... [sub (in-list (list (get-node edge)))] ; <-- hack...
#:when (not (or (eq? *-node sub) ; <-- ...for this #:unless (or (eq? *-node sub) ; <-- ...for this
(memq sub hidden)))) (memq sub hidden)))
(define name (node-> 'sub-label sub)) (define name (node-> 'sub-label sub))
(define local% (format-percent (get-node-time edge) total)) (define local% (format-percent (get-node-time edge) total))
`("" "" "" "" "" "" "" "" `("" "" "" "" "" "" "" ""

View File

@ -123,7 +123,7 @@
(define (vector-filter-not f v) (define (vector-filter-not f v)
(one-arg-check f v 'vector-filter-not) (one-arg-check f v 'vector-filter-not)
(list->vector (for/list ([i (in-vector v)] #:when (not (f i))) i))) (list->vector (for/list ([i (in-vector v)] #:unless (f i)) i)))
(define (vector-count f v . vs) (define (vector-count f v . vs)
(unless (and (procedure? f) (procedure-arity-includes? f (add1 (length vs)))) (unless (and (procedure? f) (procedure-arity-includes? f (add1 (length vs))))

View File

@ -74,13 +74,8 @@
(define undocumented-exports (define undocumented-exports
(for/list ([ex (in-list exports)] (for/list ([ex (in-list exports)]
#:when #:unless (xref-binding->definition-tag xref (list what ex) #f)
(not (xref-binding->definition-tag #:unless (skip-proc ex))
xref
(list what ex)
#f))
#:when
(not (skip-proc ex)))
ex)) ex))
(unless (null? undocumented-exports) (unless (null? undocumented-exports)

View File

@ -290,7 +290,7 @@
(set-info-need-run?! info #t)))) (set-info-need-run?! info #t))))
;; If any expected dependency changed, then we need a re-run: ;; If any expected dependency changed, then we need a re-run:
(for ([i infos] (for ([i infos]
#:when (not (or (info-need-run? i) (not (info-build? i))))) #:unless (or (info-need-run? i) (not (info-build? i))))
(let ([ch (ormap (lambda (i2) (let ([ch (ormap (lambda (i2)
(or (and (not (info? i2)) (or (and (not (info? i2))
i2) i2)

View File

@ -201,7 +201,7 @@ expressions are duplicated, and may be evaluated in different scopes.
(for ([id (in-list ids)]) (bound-id-table-set! idbm id #t)) (for ([id (in-list ids)]) (bound-id-table-set! idbm id #t))
(for/list ([(k v) (in-dict (declenv-table env))] (for/list ([(k v) (in-dict (declenv-table env))]
#:when (or (den:class? v) (den:magic-class? v) (den:parser? v)) #:when (or (den:class? v) (den:magic-class? v) (den:parser? v))
#:when (not (bound-id-table-ref idbm k #f))) #:unless (bound-id-table-ref idbm k #f))
k)) k))
;; Conventions = (listof (list regexp DeclEntry)) ;; Conventions = (listof (list regexp DeclEntry))

View File

@ -932,7 +932,7 @@ END-OF-TESTS
;; split the tests ;; split the tests
[ts (regexp-split #px"(?m:^)-+(?:$|\r?\n)" ts)]) [ts (regexp-split #px"(?m:^)-+(?:$|\r?\n)" ts)])
(parameterize ([port-count-lines-enabled #t]) (parameterize ([port-count-lines-enabled #t])
(for ([t ts] #:when (not (regexp-match? #px"^\\s*$" t))) (for ([t ts] #:unless (regexp-match? #px"^\\s*$" t))
(let ([m (or (regexp-match #px"^(.*)\n\\s*(-\\S+->)\\s*\n(.*)$" (let ([m (or (regexp-match #px"^(.*)\n\\s*(-\\S+->)\\s*\n(.*)$"
t) t)
(regexp-match #px"^(.*\\S)\\s+(-\\S+->)\\s+(\\S.*)$" (regexp-match #px"^(.*\\S)\\s+(-\\S+->)\\s+(\\S.*)$"

View File

@ -67,7 +67,7 @@
[actuals expecteds] [actuals expecteds]
([actual (in-list actual-sorted)] ([actual (in-list actual-sorted)]
[expected (in-list actual-sorted)] [expected (in-list actual-sorted)]
#:when (not (== actual expected))) #:unless (== actual expected))
(values actual expected))]) (values actual expected))])
(unless (and (null? actuals) (null? expecteds)) (unless (and (null? actuals) (null? expecteds))
(with-check-info* (with-check-info*

View File

@ -41,8 +41,8 @@
[(env l) [(env l)
(mk-env e (mk-env e
(for/fold ([h l]) (for/fold ([h l])
([(k v) (in-dict l)] ([(k v) (in-dict l)]
#:when (not (f (cons k v)))) #:unless (f (cons k v)))
(dict-remove h k)))])) (dict-remove h k)))]))
(r:define/cond-contract (make-empty-env dict) (r:define/cond-contract (make-empty-env dict)

View File

@ -116,7 +116,7 @@
(log-float-real-missed-opt (log-float-real-missed-opt
this-syntax this-syntax
(for/list ([x (in-list (syntax->list #'(f1 f2 fs ...)))] (for/list ([x (in-list (syntax->list #'(f1 f2 fs ...)))]
#:when (not (subtypeof? x -Flonum))) #:unless (subtypeof? x -Flonum))
x))) x)))
;; If an optimization was expected (whether it was safe or not doesn't matter), ;; If an optimization was expected (whether it was safe or not doesn't matter),
;; report subexpressions doing expensive exact arithmetic (Exact-Rational and ;; report subexpressions doing expensive exact arithmetic (Exact-Rational and

View File

@ -177,7 +177,7 @@
[pt (in-list pos-tys)]) [pt (in-list pos-tys)])
(tc-expr/check pa (ret pt))) (tc-expr/check pa (ret pt)))
(for ([n names] (for ([n names]
#:when (not (memq n tnames))) #:unless (memq n tnames))
(tc-error/delayed (tc-error/delayed
"unknown named argument ~a for class\nlegal named arguments are ~a" "unknown named argument ~a for class\nlegal named arguments are ~a"
n (stringify tnames))) n (stringify tnames)))

View File

@ -163,10 +163,9 @@
(let-values ([(atomic not-atomic) (partition atomic-filter? result)]) (let-values ([(atomic not-atomic) (partition atomic-filter? result)])
(define not-atomic* (define not-atomic*
(for/list ([p (in-list not-atomic)] (for/list ([p (in-list not-atomic)]
#:when #:unless (for/or ([a (in-list atomic)])
(not (for/or ([a (in-list atomic)]) (implied-atomic? p a)))
(implied-atomic? p a)))) p))
p))
;; `compact' takes care of implications between atomic props ;; `compact' takes care of implications between atomic props
(apply mk (compact (append not-atomic* atomic) #f)))]) (apply mk (compact (append not-atomic* atomic) #f)))])
(match (car fs) (match (car fs)

View File

@ -79,7 +79,7 @@
(syntax-case stx [] (syntax-case stx []
[(_ def [name ...] expr) [(_ def [name ...] expr)
(let* ([ids (syntax->list #'(name ...))]) (let* ([ids (syntax->list #'(name ...))])
(for ([bad (in-list ids)] #:when (not (identifier? bad))) (for ([bad (in-list ids)] #:unless (identifier? bad))
(wrong-syntax bad "expected an identifier")) (wrong-syntax bad "expected an identifier"))
(let*-values ([(bound unbound) (partition identifier-binding ids)]) (let*-values ([(bound unbound) (partition identifier-binding ids)])
(cond (cond

View File

@ -160,7 +160,7 @@
[(_ [name ...] body ...) [(_ [name ...] body ...)
(let* ([ids (syntax->list #'(name ...))]) (let* ([ids (syntax->list #'(name ...))])
(for ([id (in-list ids)] #:when (not (identifier? id))) (for ([id (in-list ids)] #:unless (identifier? id))
(raise-syntax-error #f "expected an identifier" stx id)) (raise-syntax-error #f "expected an identifier" stx id))
(with-syntax ([(num ...) (with-syntax ([(num ...)