Fix sort procedure in base system

This commit is contained in:
Lassi Kortela 2019-08-28 21:22:06 +03:00
parent 50063d4523
commit 471d24ce38
1 changed files with 10 additions and 8 deletions

View File

@ -1092,14 +1092,16 @@
(simple-sort grtr)))))) (simple-sort grtr))))))
(define (sort l (less? <) (key identity)) (define (sort l (less? <) (key identity))
(if (or (null? l) (null? (cdr l))) l (let sort ((l l))
(let ((piv (car l))) (if (or (null? l) (null? (cdr l)))
(receive (less grtr) l
(separate (lambda (x) (less? (key x) (key piv))) (let ((piv (car l)))
(cdr l)) (receive (less grtr)
(nconc (sort less) (separate (lambda (x) (less? (key x) (key piv)))
(list piv) (cdr l))
(sort grtr)))))) (nconc (sort less)
(list piv)
(sort grtr)))))))
(define (apropos-list key) (define (apropos-list key)
(let ((key (string-downcase (let ((key (string-downcase