made apropos symbols come out in order (as in symbol<? order)

This commit is contained in:
Abdulaziz Ghuloum 2008-12-27 13:48:49 -05:00
parent 264156f305
commit 2658e6395d
2 changed files with 25 additions and 23 deletions

View File

@ -28,16 +28,18 @@
[(symbol? name) (symbol->string name)]
[else
(die who "not a string or symbol" name)])])
(let ([libs (installed-libraries)]
[matcher
(define matcher
(compose (match-maker name)
(compose symbol->string car))])
(compose symbol->string car)))
(fold-right
(lambda (lib rest)
(define (symbol<? s1 s2)
(string<? (symbol->string s1) (symbol->string s2)))
(let ([ls (filter matcher (library-subst lib))])
(if (null? ls)
rest
(cons (cons (library-name lib) (map car ls)) rest))))
(let ([ls (list-sort symbol<? (map car ls))])
(cons (cons (library-name lib) ls) rest)))))
'()
(list-sort
(lambda (lib1 lib2)
@ -49,7 +51,7 @@
(or (string<? s1 s2)
(and (string=? s1 s2)
(f (cdr ls1) (cdr ls2)))))))))
(installed-libraries))))))
(installed-libraries)))))
(define (apropos name)
(for-each

View File

@ -1 +1 @@
1729
1730