Changeset 13838


Ignore:
Timestamp:
02/01/12 08:24:17 (3 years ago)
Author:
mevenson
Message:

Partially ddresses #196: STABLE-SORT now works for non-list sequences.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/src/org/armedbear/lisp/sort.lisp

    r12516 r13838  
    4343  (sequence::seq-dispatch sequence
    4444    (sort-list sequence predicate key)
    45     (quick-sort sequence 0 (length sequence) predicate key)
     45;;; Jorge Tavares:
     46;;; As a quick fix, I send in attach a patch that uses in stable-sort merge
     47;;; sort for all sequences. This is done by coercing the sequence to list,
     48;;; calling merge sort and coercing it back to the original sequence type.
     49;;; However, as a long term improvement, the best solution would be to
     50;;; implement a merge sort for non-list sequences.
     51    (coerce (sort-list (coerce sequence 'list)
     52           predicate
     53           key)
     54      (type-of sequence))
    4655    (apply #'sequence:stable-sort sequence predicate args)))
    4756
Note: See TracChangeset for help on using the changeset viewer.