summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2018-12-13 23:21:20 +0100
committerNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2018-12-13 23:21:20 +0100
commit01f2380053544057d23408fb2356ed5b70de542e (patch)
treeac2df389bca301380565948cc74ac9a99af8d04e /src
parentf5cbc0b753fb94785024ed81bb3738c10434bd61 (diff)
Adds some much needed syntaxic sugar.
Diffstat (limited to 'src')
-rw-r--r--src/ataxic_sugar.erl47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/ataxic_sugar.erl b/src/ataxic_sugar.erl
new file mode 100644
index 0000000..17165ac
--- /dev/null
+++ b/src/ataxic_sugar.erl
@@ -0,0 +1,47 @@
+-module(ataxic_sugar).
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% TYPES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% EXPORTS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+-export
+(
+ [
+ update_array_cell/2
+ ]
+).
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% LOCAL FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% EXPORTED FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+-spec update_array_cell (non_neg_integer(), ataxic:basic()) -> ataxic:basic().
+update_array_cell (IX, OP) ->
+ ataxic:apply_function
+ (
+ array,
+ set,
+ [
+ ataxic:constant(IX),
+ ataxic:sequence
+ (
+ ataxic:apply_function
+ (
+ array,
+ get,
+ [
+ ataxic:constant(IX),
+ ataxic:current_value()
+ ]
+ ),
+ OP
+ ),
+ ataxic:current_value()
+ ]
+ ).