Skip to content

Commit 8dbc393

Browse files
Fix 2 occurrences of nested-if-to-cond
This `if`-`else` chain can be converted to a `cond` expression.
1 parent ab811a0 commit 8dbc393

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

typed-racket-lib/typed-racket/utils/shallow-contract.rkt

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,17 @@
4848

4949
(define ((shallow-and/c . pred*) x)
5050
(let loop ([p?* pred*])
51-
(if (null? p?*)
52-
#true
53-
(if ((car p?*) x)
54-
(loop (cdr p?*))
55-
#false))))
51+
(cond
52+
[(null? p?*) #true]
53+
[((car p?*) x) (loop (cdr p?*))]
54+
[else #false])))
5655

5756
(define ((shallow-or/c . pred*) x)
5857
(let loop ([p?* pred*])
59-
(if (null? p?*)
60-
#false
61-
(if ((car p?*) x)
62-
#true
63-
(loop (cdr p?*))))))
58+
(cond
59+
[(null? p?*) #false]
60+
[((car p?*) x) #true]
61+
[else (loop (cdr p?*))])))
6462

6563
(define (shallow-shape-check val pred ty-str ctx)
6664
(if (pred val)

0 commit comments

Comments
 (0)