summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2019-10-09 19:46:13 +0200
committerNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2019-10-09 19:46:13 +0200
commitd85f6400ddd5da74a1d3fc320cf50497340537ec (patch)
tree102559eb3a58f05b2fad53b6fdbc468c3281db0b
parent1c068ee5c16b300261b3a54cfe8e0c49e36fb7ae (diff)
downloadataxia-d85f6400ddd5da74a1d3fc320cf50497340537ec.zip
ataxia-d85f6400ddd5da74a1d3fc320cf50497340537ec.tar.bz2
Validated through dialyzer.
-rw-r--r--src/ataxic_optimize.erl34
1 files changed, 18 insertions, 16 deletions
diff --git a/src/ataxic_optimize.erl b/src/ataxic_optimize.erl
index 1eadb79..590b8a9 100644
--- a/src/ataxic_optimize.erl
+++ b/src/ataxic_optimize.erl
@@ -20,21 +20,23 @@
)
-> list(ataxic:basic()).
remove_overridden_operations (List) ->
- lists:foldr
- (
- fun (Elem, CurrentResult) ->
- case CurrentResult of
- {done, _} -> CurrentResult;
- {ok, List} ->
- case Elem of
- #const{} -> {done, [Elem|List]};
- _ -> {ok, [Elem|List]}
- end
- end
- end,
- {ok, []},
- List
- ).
+ {_, Result} =
+ lists:foldr
+ (
+ fun (Elem, CurrentResult) ->
+ case CurrentResult of
+ {done, _} -> CurrentResult;
+ {ok, List} ->
+ case Elem of
+ #const{} -> {done, [Elem|List]};
+ _ -> {ok, [Elem|List]}
+ end
+ end
+ end,
+ {ok, []},
+ List
+ ),
+ Result.
% list(update_field(a, o0), update(a, o1), ...) -> update_field(a, list(o0, o1))
-spec optimize_update_field_sequence
@@ -186,7 +188,7 @@ aggressive (In = #apply_fun{ params = OPs }) ->
params = lists:map(fun aggressive/1, OPs)
};
aggressive (In = #list_cons{ param = OP }) ->
- In#list_cons{ param = lists:map(fun aggressive/1, OP) };
+ In#list_cons{ param = aggressive(OP) };
aggressive (In = #read_perm{ op = OP }) ->
In#read_perm{ op = aggressive(OP) };
aggressive (In = #write_perm{ op = OP }) ->