From 0dac7583ba836bd423ca634842e410a47144dd5f Mon Sep 17 00:00:00 2001 From: Justin Ethier Date: Sat, 15 Aug 2015 02:05:46 -0400 Subject: [PATCH] Added create-environment --- scheme/eval.sld | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/scheme/eval.sld b/scheme/eval.sld index b411db01..1092f63b 100644 --- a/scheme/eval.sld +++ b/scheme/eval.sld @@ -8,15 +8,38 @@ (define-library (scheme eval) (import (scheme cyclone util) + ;(scheme cyclone libraries) ;; for handling import sets (scheme base) (scheme file) (scheme write) (scheme read)) (export + ;environment eval + create-environment ; non-standard ) (begin +;; From r7rs: +;; This procedure returns a specifier for the environment that +;; results by starting with an empty environment and then +;; importing each list, considered as an import set, into it. +;; (See section 5.6 for a description of import sets.) The +;; bindings of the environment represented by the specifier +;; are immutable, as is the environment itself. +;; +;; Ideally, want this to allow creating new env's on top of global-env. +;(define (environment i . is) +; (let ((imports (cons i is))) +; 'TODO +; )) + +;; Create a new environment on top of the default one. +;; - vars => Identifiers in the new environment +;; - vals => List of each value assigned to each identifier +(define (create-environment vars vals) + (extend-environment vars vals *global-environment*)) ;; TODO: setup? + (define (eval exp . env) (if (null? env) ((analyze exp *global-environment*) *global-environment*)