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) (hash-set! ht (car arrs) n)
(loop (cdr arrs) (+ n 1)))) (loop (cdr arrs) (+ n 1))))
(let* ([unsorted (hash-map ht list)] (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 (map car sorted)])
arrs))) arrs)))

View File

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

View File

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

View File

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

View File

@ -647,7 +647,7 @@
(set! blame-ids (cons (cons (build-blame-identifier indy? dom? id) (set! blame-ids (cons (cons (build-blame-identifier indy? dom? id)
(vector (syntax-e id) indy? dom?)) (vector (syntax-e id) indy? dom?))
blame-ids))))) 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 (values
(map cdr blame-ids) (map cdr blame-ids)

View File

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