adjust some calls to sort: use symbol<? and use strict

predicates (to get stability)
This commit is contained in:
Robby Findler 2013-08-11 16:05:19 -05:00
parent 02b7e88588
commit 680d29d9cc
6 changed files with 8 additions and 10 deletions

View File

@ -732,7 +732,7 @@ TODO
(hash-set! ht (car arrs) n)
(loop (cdr arrs) (+ n 1))))
(let* ([unsorted (hash-map ht list)]
[sorted (sort unsorted (λ (x y) (<= (cadr x) (cadr y))))]
[sorted (sort unsorted < #:key cadr)]
[arrs (map car sorted)])
arrs)))

View File

@ -35,8 +35,7 @@
subject
description
how-to-repeat)
string<=?
#:key symbol->string))
symbol<?))
;; id : number
;; open? : boolean?
@ -74,8 +73,7 @@
(match a-saved-report
[(struct saved-report ((? number?)
(list (list (? symbol? keys) vals) ...)))
(and (equal? (sort keys string<=? #:key symbol->string)
valid-keys)
(and (equal? (sort keys symbol<?) valid-keys)
(for/and ([key (in-list keys)]
[val (in-list vals)])
(case key

View File

@ -862,7 +862,7 @@
;; has been shrunk one size, larger sizes for that child will not be
;; considered, and shrinking always proceeds from the left to the right.
(define (candidate-sizes lolon)
(define all-boxes (map (λ (x) (box (sort x >=))) lolon))
(define all-boxes (map (λ (x) (box (sort x >))) lolon))
(define answer '())
(define (record-current)
(set! answer (cons (map car (map unbox all-boxes)) answer)))

View File

@ -1311,7 +1311,7 @@
(hash-map search-bubble-table
(λ (x true)
(list x (if replace-mode? 'light-search-color 'normal-search-color)))))
string<=?
string<?
#:key (λ (x) (format "~s" (car x)))))
@ -4039,7 +4039,7 @@ designates the character that triggers autocompletion
(map sym->mpi (exported-index-desc-from-libs desc))))
(hash-set! ht (symbol->string name) #t)))))))
(xref-index xref))
(sort (hash-map ht (λ (x y) x)) string<=?))))
(sort (hash-map ht (λ (x y) x)) string<?))))
;; ============================================================
;; auto complete example code

View File

@ -647,7 +647,7 @@
(set! blame-ids (cons (cons (build-blame-identifier indy? dom? id)
(vector (syntax-e id) indy? dom?))
blame-ids)))))
(set! blame-ids (sort blame-ids string<=? #:key (λ (x) (symbol->string (syntax-e (car x))))))
(set! blame-ids (sort blame-ids symbol<? #:key (λ (x) (syntax-e (car x)))))
(values
(map cdr blame-ids)

View File

@ -1853,7 +1853,7 @@
(loop (cdr ars) acc)]))]))])
(and min-at-least
(begin
(let loop ([counts (sort (filter number? arity) >=)])
(let loop ([counts (sort (filter number? arity) >)])
(unless (null? counts)
(let ([count (car counts)])
(cond