deffns))))
(define (pmodel/find-package pmodel package-name)
- (filter (lambda (p) (equal? package-name (package/name p)))
- (pmodel/packages pmodel)))
+ (let ((pkgs (filter (lambda (p) (equal? package-name (package/name p)))
+ (pmodel/packages pmodel))))
+ (and (pair? pkgs)
+ (if (null? (cdr pkgs))
+ (car pkgs)
+ (error "Multiple packages:" package-name)))))
(define (pmodel/global-exports pmodel)
(define (global-exports package)
(append-map! global-exports (pmodel/packages pmodel)))
(define (pmodel/package-bindings pmodel package-name)
- (let ((package (pmodel/find-package pmodel package-name)))
- (if package
- (map binding/name (package/bindings package))
- (error "No such package:" package-name))))
+ (map binding/name
+ (package/bindings (pmodel/find-package pmodel package-name))))
(define (duplicates listset)
(let loop ((items listset) (duplicates '()))