aboutsummaryrefslogtreecommitdiffstats
path: root/test/scripts/atom1.milch
diff options
context:
space:
mode:
Diffstat (limited to 'test/scripts/atom1.milch')
-rw-r--r--test/scripts/atom1.milch14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/scripts/atom1.milch b/test/scripts/atom1.milch
new file mode 100644
index 0000000..0ee6f8f
--- /dev/null
+++ b/test/scripts/atom1.milch
@@ -0,0 +1,14 @@
+(import "core/common")
+
+(let state (atom! 10))
+
+(let do-loop! (\![i n]
+ (match true
+ (lt? i n) (do (atom-update! inc state)
+ (do-loop! (inc i) n))
+ otherwise unit)))
+
+(do-loop! 0 5)
+
+(atom-get! state)
+; => 15