better use of new sort

svn: r11321
This commit is contained in:
Eli Barzilay 2008-08-19 04:55:32 +00:00
parent 0dbc0d472e
commit 156d3364df
2 changed files with 8 additions and 12 deletions

View File

@ -9,9 +9,9 @@
;; get-info : (listof path-or-string) -> info/#f
(define (get-info coll-path)
(let* ([coll-path (map (lambda (x) (if (path? x) (path->string x) x)) coll-path)]
[dir (apply collection-path coll-path)])
(get-info/full dir)))
(let ([coll-path (map (lambda (x) (if (path? x) (path->string x) x))
coll-path)])
(get-info/full (apply collection-path coll-path))))
;; get-info/full : path -> info/#f
(define (get-info/full dir)
@ -41,7 +41,7 @@
expr ...)
;; No need to set a reader-guard, since we checked it
;; above (a guard will see other uses of #lang for stuff
;; that is required).
;; that is required).
;; We are, however, trusting that the bytecode form of the
;; file (if any) matches the source.
(dynamic-require file '#%info-lookup)]
@ -158,13 +158,9 @@
(hash-set! result c #t))
;; Extract the relevant collections:
(hash-map result (lambda (k v) k))))])
(sort unsorted
(lambda (a b)
(compare-directories (directory-record-path a)
(directory-record-path b))))))
(define (compare-directories a b)
(bytes<? (dir->sort-key a) (dir->sort-key b)))
(sort unsorted bytes<?
#:key (lambda (dr) (dir->sort-key (directory-record-path dr)))
#:cache-keys? #t)))
;; dir->sort-key : path -> bytes
;; extracts the name of the directory, dropping any "."s it finds at the ends.

View File

@ -383,7 +383,7 @@
cleanup))
(define (sort-collections ccs)
(sort ccs (lambda (a b) (string<? (cc-name a) (cc-name b)))))
(sort ccs string<? #:key cc-name))
(define collections-to-compile
(sort-collections