Added (lib:get-all)

This commit is contained in:
Justin Ethier 2016-08-23 03:46:50 -04:00
parent b5ddcf0dee
commit 1c0bd864c6

View file

@ -38,6 +38,7 @@
lib:import->export-list lib:import->export-list
lib:resolve-imports lib:resolve-imports
lib:resolve-meta lib:resolve-meta
lib:get-all
lib:get-all-import-deps lib:get-all-import-deps
lib:get-dep-list lib:get-dep-list
lib:imports->idb lib:imports->idb
@ -82,6 +83,14 @@
;; TODO: most of these below assume 0 or 1 instances of the directive. ;; TODO: most of these below assume 0 or 1 instances of the directive.
;; may need to replace some of these later with filter operations to ;; may need to replace some of these later with filter operations to
;; support more than 1 instance. ;; support more than 1 instance.
;; Get all instances of given tagged list from a library definition,
;; and collect the contents of them into a single list.
(define (lib:get-all ast tag)
(foldr append '()
(map cdr
(filter (lambda (l) (tagged-list? 'import l)) (cddr ast)))))
(define (lib:raw-exports ast) (define (lib:raw-exports ast)
(lib:result (lib:result
(let ((code (assoc 'export (cddr ast)))) (let ((code (assoc 'export (cddr ast))))