From 156d3364dfa5e43fb1324772eb414649a2edd528 Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Tue, 19 Aug 2008 04:55:32 +0000 Subject: [PATCH] better use of new sort svn: r11321 --- collects/setup/getinfo.ss | 18 +++++++----------- collects/setup/setup-unit.ss | 2 +- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/collects/setup/getinfo.ss b/collects/setup/getinfo.ss index 241f2a2e61..4810e50289 100644 --- a/collects/setup/getinfo.ss +++ b/collects/setup/getinfo.ss @@ -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) - (bytessort-key a) (dir->sort-key b))) + (sort unsorted bytessort-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. diff --git a/collects/setup/setup-unit.ss b/collects/setup/setup-unit.ss index a28440c862..68e9670b8e 100644 --- a/collects/setup/setup-unit.ss +++ b/collects/setup/setup-unit.ss @@ -383,7 +383,7 @@ cleanup)) (define (sort-collections ccs) - (sort ccs (lambda (a b) (string