|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.rubato.scheme.SExpr
org.rubato.scheme.Env
public final class Env
The class representing Scheme environments. Environments are linked as stacks. Searching for a symbol starts at top environment and follows links until the ground environment is reached.
Field Summary |
---|
Fields inherited from class org.rubato.scheme.SExpr |
---|
NULL, VOID |
Constructor Summary | |
---|---|
Env()
Creates an empty ground environment. |
|
Env(Env link)
Creates an empty environment on top of the environment link . |
Method Summary | |
---|---|
void |
addPrimitive(Primitive p)
Binds primitive function p to its
name in this environment. |
java.lang.String |
display()
Returns a string representation of this SExpr. |
boolean |
eq_p(SExpr sexpr)
Returns true iff this is equal to sexpr in the eq? sense. |
boolean |
equal_p(SExpr sexpr)
Returns true iff this is equal to sexpr in the equal? sense. |
boolean |
equals(java.lang.Object obj)
Returns true iff this is equal to obj . |
boolean |
eqv_p(SExpr sexpr)
Returns true iff this is equal to sexpr in the eqv? sense. |
boolean |
extendEnv(SExpr vars,
SExpr vals)
Extends this environment with bindings for each symbol in vars to its correspondings
value in vals . |
SExpr |
get(Symbol sym)
Returns the expression bound to the symbol sym . |
java.util.Set<java.util.Map.Entry<Symbol,SExpr>> |
getBindings()
Returns all bindings in this environment. |
static Env |
makeGlobalEnvironment()
Creates a ground environment containing bindings for all standard and all Rubato-specific primitives. |
static Env |
makeStandardEnvironment()
Creates a ground environment containing bindings for all standard primitives. |
Env |
pop()
Returns the environment that this environment is linked to. |
Env |
push()
Returns a new empty environment pushed on top of this. |
void |
put(java.lang.String sym,
SExpr expr)
Binds the symbol with string representation sym
to the expression sexpr in this environment. |
void |
put(Symbol sym,
SExpr sexpr)
Binds the symbol sym to the expression sexpr
in this environment. |
void |
resetGlobal()
Resets this environment to contain only standard and Rubato-specific primitives. |
void |
resetStandard()
Resets this environment to contain only standard primitives. |
boolean |
set(Symbol sym,
SExpr expr)
Binds the symbol with string representation sym
to the expression sexpr in this environment. |
java.lang.String |
toString()
Returns a string representation of this SExpr. |
Methods inherited from class org.rubato.scheme.SExpr |
---|
car, cdr, cons, getCar, getCdr, getLength, isBoolean, isChar, isClosure, isComplex, isCons, isDenotator, isForm, isInteger, isList, isNull, isNumber, isPair, isPrimitive, isRational, isReal, isString, isSymbol, isVector, isVoid, nth, setCar, setCdr |
Methods inherited from class java.lang.Object |
---|
getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Env()
public Env(Env link)
link
.
Method Detail |
---|
public Env push()
public Env pop()
public void put(Symbol sym, SExpr sexpr)
sym
to the expression sexpr
in this environment.
public void put(java.lang.String sym, SExpr expr)
sym
to the expression sexpr
in this environment.
public SExpr get(Symbol sym)
sym
.
If there is no binding in this environment, follows the link.
If there is no binding at all, returns null.
public boolean set(Symbol sym, SExpr expr)
sym
to the expression sexpr
in this environment.
The binding only succeeds, if the symbol has already been bound.
In this case true is returned, otherwise nothing happens, and
false is returned.
public java.util.Set<java.util.Map.Entry<Symbol,SExpr>> getBindings()
public void addPrimitive(Primitive p)
p
to its
name in this environment.
public boolean extendEnv(SExpr vars, SExpr vals)
vars
to its correspondings
value in vals
.
public boolean eq_p(SExpr sexpr)
SExpr
sexpr
in the eq? sense.
eq_p
in class SExpr
public boolean eqv_p(SExpr sexpr)
SExpr
sexpr
in the eqv? sense.
eqv_p
in class SExpr
public boolean equal_p(SExpr sexpr)
SExpr
sexpr
in the equal? sense.
equal_p
in class SExpr
public boolean equals(java.lang.Object obj)
SExpr
obj
. Normally this
returns the same result as SExpr.equal_p(org.rubato.scheme.SExpr)
.
equals
in class SExpr
public java.lang.String toString()
SExpr
toString
in class SExpr
public java.lang.String display()
SExpr
display
in class SExpr
public static Env makeGlobalEnvironment()
public static Env makeStandardEnvironment()
public void resetGlobal()
public void resetStandard()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |