update benz. define `include' in scheme/base.scm
This commit is contained in:
parent
04b3ac08bf
commit
8117a95b0d
|
@ -1 +1 @@
|
|||
Subproject commit c6b46ae2acba046f2c1c3f26e862134de0df846a
|
||||
Subproject commit e58f216b2da6f4a14a35825f2878728872484e30
|
|
@ -27,8 +27,7 @@
|
|||
else
|
||||
do
|
||||
when
|
||||
unless
|
||||
include)
|
||||
unless)
|
||||
|
||||
(export let-values
|
||||
let*-values
|
||||
|
|
|
@ -22,6 +22,21 @@
|
|||
|
||||
;; 4.1.7. Inclusion
|
||||
|
||||
(define-syntax include
|
||||
(letrec ((read-file
|
||||
(lambda (filename)
|
||||
(call-with-port (open-input-file filename)
|
||||
(lambda (port)
|
||||
(let loop ((expr (read port)) (exprs '()))
|
||||
(if (eof-object? expr)
|
||||
(reverse exprs)
|
||||
(loop (read port) (cons expr exprs)))))))))
|
||||
(er-macro-transformer
|
||||
(lambda (form rename compare)
|
||||
(let ((filenames (cdr form)))
|
||||
(let ((exprs (apply append (map read-file filenames))))
|
||||
`(,(rename 'begin) ,@exprs)))))))
|
||||
|
||||
(export include)
|
||||
|
||||
;; 4.2.1. Conditionals
|
||||
|
|
Loading…
Reference in New Issue