]> gerrit.simantics Code Review - simantics/platform.git/blob - tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/FoldlBuild2.scl
(refs #7307) Added features field to SCL module header
[simantics/platform.git] / tests / org.simantics.scl.compiler.tests / src / org / simantics / scl / compiler / tests / scl / FoldlBuild2.scl
1 import "Prelude"
2
3 inc :: Ref Integer -> <Proc> Integer
4 inc r = do 
5     v = getRef r
6     newV = v+1
7     r := newV
8     newV
9
10 main = do
11     r = ref 0
12     l = map (\_ -> inc r) [1..4]
13     r := 4 // Map must be executed before this statement
14     foldl (+) 0 l
15 --
16 10