]> gerrit.simantics Code Review - simantics/platform.git/blob - tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/ClosureRecursion.scl
Fixed multiple issues causing dangling references to discarded queries
[simantics/platform.git] / tests / org.simantics.scl.compiler.tests / src / org / simantics / scl / compiler / tests / scl / ClosureRecursion.scl
1 import "Prelude"
2
3 countDown :: Ref Integer -> <Proc> Boolean
4 countDown r = if currentValue <= 0
5               then False
6               else do 
7                   r := currentValue - 1
8                   True
9   where
10     currentValue = getRef r 
11
12 strangeLoop :: (<Proc> Boolean) -> <Proc> ()
13 strangeLoop cond = if cond
14                    then strangeLoop cond
15                    else ()
16
17 main = do
18     r = ref 100000 :: Ref Integer
19     strangeLoop (countDown r)
20 --
21 ()