utils: Add make-user-module.

* haunt/utils.scm (make-user-module): New procedure.
This commit is contained in:
David Thompson 2015-10-12 19:29:57 -04:00
parent 288913eff2
commit ec79e5ad1f
1 changed files with 10 additions and 1 deletions

View File

@ -38,7 +38,8 @@
delete-file-recursively
mkdir-p
string->date*
take-up-to))
take-up-to
make-user-module))
(define* (flatten lst #:optional depth)
"Return a list that recursively concatenates the sub-lists of LST,
@ -146,3 +147,11 @@ are fewer than N elements."
(() '())
((head . tail)
(cons head (take-up-to (1- n) tail))))))
(define (make-user-module modules)
"Return a new user module with the additional MODULES loaded."
(let ((module (make-fresh-user-module)))
(for-each (lambda (iface)
(module-use! module (resolve-interface iface)))
modules)
module))