2e reviewed manuscript

This commit is contained in:
Luciano Ramalho
2021-11-12 11:33:12 -03:00
parent f5e3cb8ad3
commit 80f7f84274
32 changed files with 323 additions and 156 deletions

View File

@@ -27,11 +27,13 @@ Doctest for `Environment`
>>> inner_env = {'a': 2}
>>> outer_env = {'a': 0, 'b': 1}
>>> env = Environment(inner_env, outer_env)
>>> env['a'] = 111 # <1>
>>> env['a'] # <1>
2
>>> env['a'] = 111 # <2>
>>> env['c'] = 222
>>> env
Environment({'a': 111, 'c': 222}, {'a': 0, 'b': 1})
>>> env.change('b', 333) # <2>
>>> env.change('b', 333) # <3>
>>> env
Environment({'a': 111, 'c': 222}, {'a': 0, 'b': 333})

View File

@@ -65,7 +65,7 @@ def parse_atom(token: str) -> Atom:
class Environment(ChainMap[Symbol, Any]):
"A ChainMap that allows changing an item in-place."
def change(self, key: Symbol, value: object) -> None:
def change(self, key: Symbol, value: Any) -> None:
"Find where key is defined and change the value there."
for map in self.maps:
if key in map:

View File

@@ -62,7 +62,7 @@ def parse_atom(token: str) -> Atom:
class Environment(ChainMap[Symbol, Any]):
"A ChainMap that allows changing an item in-place."
def change(self, key: Symbol, value: object) -> None:
def change(self, key: Symbol, value: Any) -> None:
"Find where key is defined and change the value there."
for map in self.maps:
if key in map: