| summaryrefslogtreecommitdiff |
diff options
| author | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2019-10-21 21:48:00 +0200 |
|---|---|---|
| committer | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2019-10-21 21:48:00 +0200 |
| commit | be2e04aac78b04b4f016c3e0920388bd5c7f5ac6 (patch) | |
| tree | 556c83f0b8e56bfdb6b864252d9992ea54a07c5a | |
| parent | 8cb4471731d73d02e39e79ad7232735855db76ae (diff) | |
Fixes apply('bind'), optimizes 'bind', 'ternary'.
| -rw-r--r-- | src/ataxic.erl | 4 | ||||
| -rw-r--r-- | src/ataxic_optimize.erl | 14 |
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. |


