* added an auxilary procedure library-exists? for the library

manager.
This commit is contained in:
Abdulaziz Ghuloum 2007-05-07 03:45:13 -04:00
parent 22b191334f
commit 97cd3dc461
2 changed files with 6 additions and 1 deletions

Binary file not shown.

View File

@ -45,6 +45,11 @@
(find-library-by
(lambda (x) (equal? (library-name x) name))))
(define (library-exists? name)
(and (find-library-by
(lambda (x) (equal? (library-name x) name)))
#t))
(define (find-library-by-spec/die spec)
(let ([id (car spec)])
(or (find-library-by
@ -60,7 +65,7 @@
[inv-lib* (map find-library-by-spec/die inv*)])
(unless (and (symbol? id) (list? name) (list? ver))
(error 'install-library "invalid spec ~s ~s ~s" id name ver))
(when (find-library-by-name name)
(when (library-exists? name)
(error 'install-library "~s is already installed" name))
(let ([lib (make-library id name ver imp-lib* vis-lib* inv-lib*
exp-subst exp-env visit-code invoke-code)])