I am attempting to create a simple language interpreter for a homework assignment in PLT Scheme (Racket). For tracking variable bindings, I cannot seem to create and update an environment that tracks assigned variables and their values. In the MIT Scheme Reference, I found information about environments being first class objects, but using the commands listed there (such as environment-bound?) do not work in PLT Scheme.
What is the best way to accomplish this is scheme without using let or any imperative-like (!) functionality?
If you’re just creating an interpreter in Scheme, you might want to just create your own environment data structure, possibly as an association list:
((var1 val1) (var2 val2) (var3 val3))and so on. It’s simpler to pass around and update the environment as a list, rather than dealing with any particular Scheme’s implementation of environments.