3 import scala
.collection
.mutable
6 class Env(outer
: Env
= null,
7 binds
: Iterator
[Any
] = null,
8 exprs
: Iterator
[Any
] = null) {
9 val data
: mutable
.Map
[Symbol
, Any
] = mutable
.Map()
10 if (binds
!= null && exprs
!= null) {
12 val k
= b
.asInstanceOf
[Symbol
]
14 data(binds.next().asInstanceOf[Symbol]) = _list(exprs.toSeq:_*)
16 data(k) = exprs.next()
21 def find(key: Symbol): Env = {
22 if (data.contains(key)) {
24 } else if (outer != null) {
30 def set(key: Symbol, value: Any): Any = {
34 def get(key: Symbol): Any = {
36 if (env == null) throw new Exception("'" + key.name + "' not found")