summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ataxic.erl4
-rw-r--r--src/ataxic_optimize.erl14
2 files changed, 17 insertions, 1 deletions
diff --git a/src/ataxic.erl b/src/ataxic.erl
index bb9e561..2993639 100644
--- a/src/ataxic.erl
+++ b/src/ataxic.erl
@@ -155,7 +155,9 @@ apply_basic_to (#letr{ bindings = Bindings, op = OP }, Val, S0Mem) ->
S1Mem =
lists:foldl
(
- fun ({Key, Value}, Memory) -> dict:store(Key, Value, Memory) end,
+ fun ({Key, Value}, Memory) ->
+ dict:store(Key, apply_basic_to(Value, Val, Memory), Memory)
+ end,
S0Mem,
Bindings
),
diff --git a/src/ataxic_optimize.erl b/src/ataxic_optimize.erl
index 39f45f7..cf6cd3a 100644
--- a/src/ataxic_optimize.erl
+++ b/src/ataxic_optimize.erl
@@ -303,6 +303,20 @@ aggressive (In = #value{ op = OP }) ->
In#value{ op = aggressive(OP) };
aggressive (In = #mseq{ ops = OPs }) ->
In#mseq{ ops = lists:map(fun aggressive/1, OPs) };
+aggressive (In = #letr{ bindings = Bs, op = OP }) ->
+ In#letr
+ {
+ op = aggressive(OP),
+ bindings =
+ lists:map(fun ({Key, Value}) -> {Key, aggressive(Value)} end, Bs)
+ };
+aggressive (In = #tern{ condition = C, then = T, else = E }) ->
+ In#tern
+ {
+ condition = aggressive(C),
+ then = aggressive(T),
+ else = aggressive(E)
+ };
aggressive (Other) ->
Other.