]> gerrit.simantics Code Review - simantics/platform.git/blob - tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/FoldlBuild1.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 / FoldlBuild1.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     // Because both map and for get side-effectful functions
13     // as parameters, the fusion is not allowed.
14     l = map (\_ -> inc r) [1..4]    
15     for l (\i -> r := i+1)
16     getRef r
17 --
18 5