Skip to content

Commit 56c5100

Browse files
Fix 3 occurrences of sort-with-keyed-comparator-to-sort-by-key
This `sort` expression can be replaced with a simpler, equivalent expression.
1 parent ced28a9 commit 56c5100

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

typed-racket-lib/typed-racket/types/kw-types.rkt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@
3131
;; the kw protocol puts the arguments in keyword-sorted order in the
3232
;; function header, so we need to sort the types to match
3333
(define sorted-kws
34-
(sort keywords (λ (kw1 kw2) (keyword<? (Keyword-kw kw1)
35-
(Keyword-kw kw2)))))
34+
(sort keywords keyword<? #:key Keyword-kw))
3635

3736
(define pos-opt-arg-types
3837
(append (for/list ([t (in-list optional-arg-types)]
@@ -148,9 +147,7 @@
148147
(define (calculate-mandatory-args orig-arrows)
149148
;; sorted order is important, our loops below rely on this order
150149
(define arity-sorted-arrows
151-
(sort orig-arrows
152-
(λ (a1 a2) (>= (Arrow-max-arity a1)
153-
(Arrow-max-arity a2)))))
150+
(sort orig-arrows >= #:key Arrow-max-arity))
154151
(for/fold ([mand-arg-table '()])
155152
([arrow (in-list arity-sorted-arrows)])
156153
(cond

typed-racket-lib/typed-racket/types/prop-ops.rkt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -379,9 +379,7 @@
379379
[(AndProp: ps*) (partition! ps*)]
380380
[_ (set! others (cons p others))])))
381381
(define ors-smallest-to-largest
382-
(append-map cdr (sort (hash->list ors)
383-
(λ (len/ors1 len/ors2)
384-
(< (car len/ors1) (car len/ors2))))))
382+
(append-map cdr (sort (hash->list ors) < #:key car)))
385383
(remove-duplicates (append ts nts others ors-smallest-to-largest) eq?))
386384
(let loop ([ps (flatten-ands/remove-duplicates/order args)]
387385
[result null])

0 commit comments

Comments
 (0)