aboutsummaryrefslogtreecommitdiff
path: root/src/algebra/any.spad.pamphlet
diff options
context:
space:
mode:
Diffstat (limited to 'src/algebra/any.spad.pamphlet')
-rw-r--r--src/algebra/any.spad.pamphlet32
1 files changed, 30 insertions, 2 deletions
diff --git a/src/algebra/any.spad.pamphlet b/src/algebra/any.spad.pamphlet
index 52d756f0..d86a0cd4 100644
--- a/src/algebra/any.spad.pamphlet
+++ b/src/algebra/any.spad.pamphlet
@@ -346,7 +346,7 @@ Scope(): Public == Private where
findBinding(n,s) ==
for c in contours s repeat
b := findBinding(n,c)$Contour
- not b case "failed" => b
+ not b case "failed" => return b
"failed"
pushNewContour(b,s) ==
@@ -368,7 +368,7 @@ Scope(): Public == Private where
)abbrev domain ENV Environment
++ Author: Gabriel Dos Reis
++ Date Created: October 24, 2007
-++ Date Last Modified: January 18, 2008.
+++ Date Last Modified: January 19, 2008.
++ An `Environment' is a stack of scope.
Environment(): Public == Private where
Public ==> CoercibleTo(OutputForm) with
@@ -376,6 +376,18 @@ Environment(): Public == Private where
++ empty() constructs an empty environment
scopes: % -> List Scope
++ scopes(e) returns the stack of scopes in environment e.
+ getProperty: (Symbol, Symbol, %) -> Union(SExpression, "failed")
+ ++ getProperty(n,p,e) returns the value of property with name `p'
+ ++ for the symbol `n' in environment `e'. Otherwise, `failed'.
+ setProperty!: (Symbol, Symbol, SExpression, %) -> %
+ ++ setProperty!(n,p,v,e) binds the property `(p,v)' to `n'
+ ++ in the topmost scope of `e'.
+ getProperties: (Symbol, %) -> Union(List ObjectProperty, "failed")
+ ++ getBinding(n,e) returns the list of properties of `n' in
+ ++ e; otherwise `failed'.
+ setProperties!: (Symbol, List ObjectProperty, %) -> %
+ ++ setBinding!(n,props,e) set the list of properties of `n'
+ ++ to `props' in `e'.
currentEnv: () -> %
++ the current normal environment in effect.
categoryFrame: () -> %
@@ -388,6 +400,22 @@ Environment(): Public == Private where
scopes e ==
e pretend List(Scope)
+ getProperty(n,p,e) ==
+ v := get(n,p,e)$Lisp
+ null? v => "failed"
+ v
+
+ setProperty!(n,p,v,e) ==
+ put(n,p,v,e)$Lisp @ %
+
+ getProperties(n,e) ==
+ b: SExpression := getProplist(n,e)$Lisp
+ null? b => "failed"
+ b pretend List(ObjectProperty)
+
+ setProperties!(n,b,e) ==
+ addBinding(n,b,e)$Lisp @ %
+
currentEnv() ==
_$e$Lisp @ %