[plt-scheme] representing environments in Java
On Tue, Feb 3, 2009 at 2:05 AM, John Clements <clements at brinckerhoff.org> wrote:
> More specifically: in order to implement a simple interpreter, you need maps
> with functional update. I spent about fifteen minutes poking around, and
> found absolutely no way to use the existing Java standard libraries to
> achieve this. To the best of my knowledge, the only correct way to do this
> is by "rolling your own"; in essence, following the first few chapters of
> HtDC to create a List interface with two concrete subclasses, Cons and MT.
You could use a hashmap and the clone method, ie isntead of just
calling 'add' call 'clone' and then 'add'.
Not sure about performance relative to an assoc, tho.
Robby