Class | Tree | Deprecated | Index | Help
PREV | NEXT SHOW LISTS | HIDE LISTS

Class silk.Environment

java.lang.Object
 |
 +----silk.SchemeUtils
 |
 +----silk.Environment

public class Environment
extends SchemeUtils
Environments allow you to look up the value of a variable, given its name. Keep a list of variables and values, and a pointer to the parent environment. If a variable list ends in a symbol rather than null, it means that symbol is bound to the remainder of the values list.


Field Summary
Environment parent
java.lang.Object vals
java.lang.Object vars
Fields inherited from class silk.SchemeUtils
FALSE , ONE , TRUE , ZERO

Constructor Summary
Environment (java.lang.Object vars, java.lang.Object vals, Environment parent)
A constructor to extend an environment with var/val pairs.
Environment ()
Construct an empty environment: no bindings.

Method Summary
java.lang.Object define (java.lang.Object var, java.lang.Object val)
Add a new variable,value pair to this environment.
Environment defPrim (java.lang.String name, int id, int minArgs)
Environment defPrim (java.lang.String name, int id, int minArgs, int maxArgs)
java.lang.Object lookup (java.lang.String symbol)
Find the value of a symbol, in this environment or a parent.
java.lang.Object set (java.lang.Object var, java.lang.Object val)
Set the value of an existing variable
Methods inherited from class silk.SchemeUtils
chr, chr, cons, equal, eqv, error, first, inPort, length, list, list, listStar, listToString, listToVector, num, num, outPort, rest, reverse, second, setFirst, setRest, str, sym, third, truth, truth, vec, vectorToList, warn, write
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail

vars

public java.lang.Object vars

vals

public java.lang.Object vals

parent

public Environment parent
Constructor Detail

Environment

public Environment(java.lang.Object vars,
 java.lang.Object vals,
 Environment parent)
A constructor to extend an environment with var/val pairs.

Environment

public Environment()
Construct an empty environment: no bindings.
Method Detail

lookup

public java.lang.Object lookup(java.lang.String symbol)
Find the value of a symbol, in this environment or a parent.

define

public java.lang.Object define(java.lang.Object var,
 java.lang.Object val)
Add a new variable,value pair to this environment.

set

public java.lang.Object set(java.lang.Object var,
 java.lang.Object val)
Set the value of an existing variable

defPrim

public Environment defPrim(java.lang.String name,
 int id,
 int minArgs)

defPrim

public Environment defPrim(java.lang.String name,
 int id,
 int minArgs,
 int maxArgs)

Class | Tree | Deprecated | Index | Help
PREV | NEXT SHOW LISTS | HIDE LISTS

AltStyle によって変換されたページ (->オリジナル) /