]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.compiler/tests/org/simantics/scl/compiler/tests/scl/FoldlBuild2.scl
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.scl.compiler / tests / org / simantics / scl / compiler / tests / scl / FoldlBuild2.scl
diff --git a/bundles/org.simantics.scl.compiler/tests/org/simantics/scl/compiler/tests/scl/FoldlBuild2.scl b/bundles/org.simantics.scl.compiler/tests/org/simantics/scl/compiler/tests/scl/FoldlBuild2.scl
new file mode 100644 (file)
index 0000000..2078fb7
--- /dev/null
@@ -0,0 +1,16 @@
+import "Prelude"\r
+\r
+inc :: Ref Integer -> <Proc> Integer\r
+inc r = do \r
+    v = getRef r\r
+    newV = v+1\r
+    r := newV\r
+    newV\r
+\r
+main = do\r
+    r = ref 0\r
+    l = map (\_ -> inc r) [1..4]\r
+    r := 4 // Map must be executed before this statement\r
+    foldl (+) 0 l\r
+--\r
+10\r