"use strict";
var expect = require('expect.js');
"use strict";
var expect = require('expect.js');
var fs = require(‘fs’); var List = require(‘./list.js’); var Pair = require(‘../lib/pair.js’); var String = require(‘../lib/string.js’); var PP = require(‘../lib/pprinter.js’); var IO = require(‘../lib/monad.js’).IO;
const Env = {
empty: (variable) => {
return undefined;
},
/* 変数名に対応する値を環境から取りだす */
lookupEnv:: (STRING, ENV) => M[VALUE]
lookup: (identifier, environment) => {
return environment(identifier);
},
/* 環境を拡張する */
extendEnv:: (STRING, VALUE, ENV) => ENV
extend: (identifier, value, environment) => {
expect(identifier).to.a('string');
return (queryIdentifier) => {
expect(queryIdentifier).to.a('string');
if(identifier === queryIdentifier) {
return value;
} else {
return Env.lookup(queryIdentifier, environment);
}
};
}
};
module.exports = Env