aboutsummaryrefslogtreecommitdiff
path: root/src/interp
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2013-05-08 22:49:20 +0000
committerdos-reis <gdr@axiomatics.org>2013-05-08 22:49:20 +0000
commit146c880a873a04fc433125646dd998882354f1c5 (patch)
treed3c5d821eb7295718e13fbf4af50b1f602e8226a /src/interp
parentcddf510296900897a19d67614e4cf4e145da8646 (diff)
downloadopen-axiom-146c880a873a04fc433125646dd998882354f1c5.tar.gz
Almost pure function bodies are now %redex forms
Diffstat (limited to 'src/interp')
-rw-r--r--src/interp/c-util.boot12
-rw-r--r--src/interp/compiler.boot6
2 files changed, 11 insertions, 7 deletions
diff --git a/src/interp/c-util.boot b/src/interp/c-util.boot
index 5a07644d..b6e253c3 100644
--- a/src/interp/c-util.boot
+++ b/src/interp/c-util.boot
@@ -1421,6 +1421,16 @@ expandableDefinition?(vars,body) ==
['XLAM,vars',body]
nil
+++ A list of routines for diagnostic reports. These functions, in an
+++ abstract sense, have type: forall T: Type . String -> T, so they
+++ can be used in T-returning functions, for any T.
+$coreDiagnosticFunctions ==
+ '(error userError systemError)
+
+almostPure? x ==
+ ops := [:$coreDiagnosticFunctions,:$VMsideEffectFreeOperators]
+ semiSimpleRelativeTo?(x,ops)
+
++ `defs' is a list of function definitions from the current domain.
++ Walk that list and replace references to unconditional operations
++ with their corresponding linkage names.
@@ -1433,7 +1443,7 @@ foldExportedFunctionReferences defs ==
form := expandableDefinition?(vars,body) =>
registerFunctionReplacement(name,form)
second(fun) := ["LAMBDA",vars,["DECLARE",["IGNORE",last vars]],body]
- if sideEffectFree? body then
+ if almostPure? body then
registerRedexForm(name,vars,body)
lamex.absBody := body
defs
diff --git a/src/interp/compiler.boot b/src/interp/compiler.boot
index ef8859cb..ebc3711a 100644
--- a/src/interp/compiler.boot
+++ b/src/interp/compiler.boot
@@ -76,12 +76,6 @@ reshapeArgumentList: (%Form,%Sig) -> %Form
applyMapping: (%Form,%Mode,%Env,%List %Mode) -> %Maybe %Triple
-++ A list of routines for diagnostic reports. These functions, in an
-++ abstract sense, have type: forall T: Type . String -> T, so they
-++ can be used in T-returning functions, for any T.
-$coreDiagnosticFunctions ==
- '(error userError systemError)
-
$IOFormDomains ==
[$InputForm,$OutputForm,$Syntax]