diff --git a/collects/tests/mzscheme/list.ss b/collects/tests/mzscheme/list.ss index 76d3f92aa5..2e1b0f9d83 100644 --- a/collects/tests/mzscheme/list.ss +++ b/collects/tests/mzscheme/list.ss @@ -97,15 +97,14 @@ (let () (define l '((0) (9) (1) (8) (2) (7) (3) (6) (4) (5))) (define sorted '((0) (1) (2) (3) (4) (5) (6) (7) (8) (9))) - ;; can't use keyword args, so use values and the sort call - (test sorted values (sort l < #:key car)) + (test sorted sort l < #:key car) (let ([c1 0] [c2 0] [touched '()]) - (test sorted values - (sort l (lambda (x y) (set! c1 (add1 c1)) (< x y)) - #:key (lambda (x) - (set! c2 (add1 c2)) - (set! touched (cons x touched)) - (car x)))) + (test sorted + sort l (lambda (x y) (set! c1 (add1 c1)) (< x y)) + #:key (lambda (x) + (set! c2 (add1 c2)) + (set! touched (cons x touched)) + (car x))) ;; test that the number of key uses is half the number of comparisons (test #t = (* 2 c1) c2) ;; and that this is larger than the number of items in the list @@ -114,32 +113,32 @@ (test null remove* touched l)) (let ([c 0] [touched '()]) ;; now cache the keys - (test sorted values - (sort l < - #:key (lambda (x) - (set! c (add1 c)) - (set! touched (cons x touched)) - (car x)) - #:cache-keys? #t)) + (test sorted + sort l < + #:key (lambda (x) + (set! c (add1 c)) + (set! touched (cons x touched)) + (car x)) + #:cache-keys? #t) ;; test that the number of key uses is the same as the list length (test #t = c (length l)) ;; and that every item was touched (test null remove* touched l)) (let* ([c 0] [getkey (lambda (x) (set! c (add1 c)) x)]) ;; either way, we never use the key proc on no arguments - (test '() values (sort '() < #:key getkey #:cache-keys? #f)) - (test '() values (sort '() < #:key getkey #:cache-keys? #t)) + (test '() sort '() < #:key getkey #:cache-keys? #f) + (test '() sort '() < #:key getkey #:cache-keys? #t) (test #t = c 0) ;; we also don't use it for 1-arg lists - (test '(1) values (sort '(1) < #:key getkey #:cache-keys? #f)) + (test '(1) sort '(1) < #:key getkey #:cache-keys? #f) (test #t = c 0) ;; but we do use it once if caching happens (it's a consistent interface) - (test '(1) values (sort '(1) < #:key getkey #:cache-keys? #t)) + (test '(1) sort '(1) < #:key getkey #:cache-keys? #t) (test #t = c 1) ;; check a few other short lists - (test '(1 2) values (sort '(2 1) < #:key getkey #:cache-keys? #t)) - (test '(1 2 3) values (sort '(2 3 1) < #:key getkey #:cache-keys? #t)) - (test '(1 2 3 4) values (sort '(4 2 3 1) < #:key getkey #:cache-keys? #t)) + (test '(1 2) sort '(2 1) < #:key getkey #:cache-keys? #t) + (test '(1 2 3) sort '(2 3 1) < #:key getkey #:cache-keys? #t) + (test '(1 2 3 4) sort '(4 2 3 1) < #:key getkey #:cache-keys? #t) (test #t = c 10))) ;; ---------- take/drop ----------