From 5112a6a054af94dec9921e2ca2221071b15480b4 Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Sat, 1 Apr 2006 12:24:15 +0000 Subject: [PATCH] {quick,merge}sort -> sort svn: r2569 original commit: 16f01a1109691d2fa4844b9411410f4794cf0dc1 --- collects/parser-tools/private-lex/deriv.ss | 28 +++++++++++----------- collects/parser-tools/private-lex/front.ss | 2 +- collects/parser-tools/private-lex/util.ss | 2 +- collects/parser-tools/private-yacc/lr0.ss | 11 ++++----- collects/parser-tools/yacc-to-scheme.ss | 4 ++-- 5 files changed, 23 insertions(+), 24 deletions(-) diff --git a/collects/parser-tools/private-lex/deriv.ss b/collects/parser-tools/private-lex/deriv.ss index 880c85f..334100d 100644 --- a/collects/parser-tools/private-lex/deriv.ss +++ b/collects/parser-tools/private-lex/deriv.ss @@ -239,19 +239,19 @@ (cond ((and (null? old-states) (null? new-states)) (make-dfa (get-state-number) (state-index start) - (mergesort (filter (lambda (x) (cdr x)) - (map (lambda (state) - (cons (state-index state) (get-final (state-spec state)))) - all-states)) - (lambda (a b) (< (car a) (car b)))) - (mergesort (hash-table-map transitions - (lambda (state trans) - (cons (state-index state) - (map (lambda (t) - (cons (car t) - (state-index (cdr t)))) - trans)))) - (lambda (a b) (< (car a) (car b)))))) + (sort (filter (lambda (x) (cdr x)) + (map (lambda (state) + (cons (state-index state) (get-final (state-spec state)))) + all-states)) + (lambda (a b) (< (car a) (car b)))) + (sort (hash-table-map transitions + (lambda (state trans) + (cons (state-index state) + (map (lambda (t) + (cons (car t) + (state-index (cdr t)))) + trans)))) + (lambda (a b) (< (car a) (car b)))))) ((null? old-states) (loop new-states null all-states (compute-chars new-states))) ((null? cs) @@ -336,4 +336,4 @@ (repetition 1 +inf.0 "1"))))))) (define t14 (build-test-dfa `((complement "1")))) |# - ) \ No newline at end of file + ) diff --git a/collects/parser-tools/private-lex/front.ss b/collects/parser-tools/private-lex/front.ss index 4029e92..5a35fa3 100644 --- a/collects/parser-tools/private-lex/front.ss +++ b/collects/parser-tools/private-lex/front.ss @@ -31,7 +31,7 @@ (let* ((from-state (car trans)) (all-chars/to (cdr trans)) (flat-all-chars/to - (mergesort + (sort (apply append (map (lambda (chars/to) (let ((char-ranges (loc:integer-set-contents (car chars/to))) diff --git a/collects/parser-tools/private-lex/util.ss b/collects/parser-tools/private-lex/util.ss index 931c54d..903fdeb 100644 --- a/collects/parser-tools/private-lex/util.ss +++ b/collects/parser-tools/private-lex/util.ss @@ -85,7 +85,7 @@ ;; Sorts l according to index and removes the entries with duplicate ;; indexes. (define (do-simple-equiv l index) - (let ((ordered (mergesort l (lambda (a b) (< (index a) (index b)))))) + (let ((ordered (sort l (lambda (a b) (< (index a) (index b)))))) (remove-dups ordered index null))) (test-block () diff --git a/collects/parser-tools/private-yacc/lr0.ss b/collects/parser-tools/private-yacc/lr0.ss index dbbcc00..6667459 100644 --- a/collects/parser-tools/private-yacc/lr0.ss +++ b/collects/parser-tools/private-yacc/lr0.ss @@ -28,7 +28,7 @@ (non-term-index (trans-key-gs b))))))) (define (trans-key-list-remove-dups tkl) - (let loop ((sorted (quicksort tkl trans-key ;; (vectorof (symbol X hashtable)) (define (build-transition-table num-states assoc) @@ -279,7 +278,7 @@ (let* ((gs (car i)) (items (cadr i)) (new #f) - (new-kernel (quicksort + (new-kernel (sort (filter (lambda (x) x) (map move-dot-right items)) item