diff options
author | dos-reis <gdr@axiomatics.org> | 2009-06-13 21:53:21 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2009-06-13 21:53:21 +0000 |
commit | 700e13eca3eaac940000e3529d761dc7b4b15e5e (patch) | |
tree | b3121af3c00a59bb0ce0ae0146d7414057d2dce3 /src/algebra/any.spad.pamphlet | |
parent | 132209605a569012699d48f985c09c4f5826a0d2 (diff) | |
download | open-axiom-700e13eca3eaac940000e3529d761dc7b4b15e5e.tar.gz |
* algebra/any.spad.pamphlet (AnyFunctions1): Remove `pretend'
shenanigans. Use is-case pattern matching.
* interp/g-opt.boot (varIsAssigned): New.
(canInlineVarDefinition): New.
(optLET): Use it to inline functionally used local variables.
Register as backend optimizer.
Diffstat (limited to 'src/algebra/any.spad.pamphlet')
-rw-r--r-- | src/algebra/any.spad.pamphlet | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/algebra/any.spad.pamphlet b/src/algebra/any.spad.pamphlet index 0b7cd216..e7818eb2 100644 --- a/src/algebra/any.spad.pamphlet +++ b/src/algebra/any.spad.pamphlet @@ -231,6 +231,7 @@ import Any ++ Date Created: ++ Change History: ++ Basic Functions: coerce, retractIfCan, retractable?, retract +++ Date Last Updated: June 13, 2009. ++ Related Constructors: Any ++ Also See: ++ AMS Classification: @@ -262,16 +263,22 @@ AnyFunctions1(S:Type): with Sexpr:SExpression := devaluate(S)$Lisp - retractable? a == dom(a) = Sexpr coerce(s:S):Any == any(Sexpr, s::None) + retractable? a == + case a is + s: S => true + otherwise => false + retractIfCan a == - retractable? a => obj(a) pretend S - "failed" + case a is + s: S => s + otherwise => "failed" retract a == - retractable? a => obj(a) pretend S - error "Cannot retract value." + case a is + s: S => s + otherwise => error "Cannot retract value." @ |