Implement scheme-report-environment and null-environment.
authorChris Hanson <org/chris-hanson/cph>
Thu, 25 Oct 2018 02:14:01 +0000 (19:14 -0700)
committerChris Hanson <org/chris-hanson/cph>
Thu, 25 Oct 2018 04:26:41 +0000 (21:26 -0700)
src/runtime/library-loader.scm
src/runtime/library-standard.scm
src/runtime/runtime.pkg

index bb1815a7573ebd1e5983eef987fd8b172128b7e5..61b76fe03b437de8dbba8dca39d21299640f3e42 100644 (file)
@@ -120,7 +120,10 @@ USA.
 (define (environment . import-sets)
   (let ((parsed (map parse-import-set import-sets))
        (db host-library-db))
-    (let ((unusable (remove parsed-import-expandable? parsed)))
+    (let ((unusable
+          (remove (lambda (import)
+                    (parsed-import-expandable? import db))
+                  parsed)))
       (if (pair? unusable)
          (error "Imports not usable:" unusable)))
     (let ((imports (expand-parsed-imports parsed db)))
@@ -132,6 +135,19 @@ USA.
            (error "Imported libraries unavailable:"
                   (library-imports-from unavailable))))
       (make-environment-from-imports imports db))))
+
+(define (scheme-report-environment version)
+  (if (not (eqv? version 5))
+      (error "Unsupported version:" version))
+  (environment '(scheme r5rs)))
+
+(define (null-environment version)
+  (if (not (eqv? version 5))
+      (error "Unsupported version:" version))
+  (environment '(only (scheme r5rs)
+                     ... => _ and begin case cond define define-syntax delay do
+                     else if lambda let let* let-syntax letrec letrec-syntax or
+                     quasiquote quote set! syntax-rules)))
 \f
 ;;;; Evaluation
 
index b9b2b1a4b03e9fc535b49f08dfc2d49a3b8dd34e..39114b8b6bc24127c46c031d4f221da3f5386107 100644 (file)
@@ -687,7 +687,7 @@ USA.
     negative?
     newline
     not
-    ;;null-environment
+    null-environment
     null?
     number->string
     number?
@@ -713,7 +713,7 @@ USA.
     remainder
     reverse
     round
-    ;;scheme-report-environment
+    scheme-report-environment
     set!
     set-car!
     set-cdr!
index a413da278c54ef4e91ce623044ce70d27a1b7485..dc5aa5ae8e341febb139588e7b6ba4560ad888e0 100644 (file)
@@ -5959,6 +5959,8 @@ USA.
   (parent (runtime library))
   (export ()
          environment                   ;R7RS
+         null-environment              ;R7RS
+         scheme-report-environment     ;R7RS
          )
   (export (runtime)
          eval-r7rs-scode-file