made apropos symbols come out in order (as in symbol<? order)
This commit is contained in:
parent
264156f305
commit
2658e6395d
|
@ -28,16 +28,18 @@
|
||||||
[(symbol? name) (symbol->string name)]
|
[(symbol? name) (symbol->string name)]
|
||||||
[else
|
[else
|
||||||
(die who "not a string or symbol" name)])])
|
(die who "not a string or symbol" name)])])
|
||||||
(let ([libs (installed-libraries)]
|
(define matcher
|
||||||
[matcher
|
|
||||||
(compose (match-maker name)
|
(compose (match-maker name)
|
||||||
(compose symbol->string car))])
|
(compose symbol->string car)))
|
||||||
(fold-right
|
(fold-right
|
||||||
(lambda (lib rest)
|
(lambda (lib rest)
|
||||||
|
(define (symbol<? s1 s2)
|
||||||
|
(string<? (symbol->string s1) (symbol->string s2)))
|
||||||
(let ([ls (filter matcher (library-subst lib))])
|
(let ([ls (filter matcher (library-subst lib))])
|
||||||
(if (null? ls)
|
(if (null? ls)
|
||||||
rest
|
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
|
(list-sort
|
||||||
(lambda (lib1 lib2)
|
(lambda (lib1 lib2)
|
||||||
|
@ -49,7 +51,7 @@
|
||||||
(or (string<? s1 s2)
|
(or (string<? s1 s2)
|
||||||
(and (string=? s1 s2)
|
(and (string=? s1 s2)
|
||||||
(f (cdr ls1) (cdr ls2)))))))))
|
(f (cdr ls1) (cdr ls2)))))))))
|
||||||
(installed-libraries))))))
|
(installed-libraries)))))
|
||||||
|
|
||||||
(define (apropos name)
|
(define (apropos name)
|
||||||
(for-each
|
(for-each
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
1729
|
1730
|
||||||
|
|
Loading…
Reference in New Issue