]> gerrit.simantics Code Review - simantics/platform.git/blob - tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/Transformation3.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 / Transformation3.scl
1 import "StandardLibrary"
2
3 mapping relation Fib Integer Integer
4
5 rule FibRecurrence where
6     @when
7     Fib ?n (?a + ?b)
8     ?n >= 2
9     
10     @where
11     Fib (?n-1) ?b
12     Fib (?n-2) ?a
13
14 rule Init where
15     @when
16     Fib ?x 1
17     ?x < 2
18     
19 rule Seed where
20     @where
21     Fib 20 ?hmm
22
23 rule PrintIt where
24     @when
25     Fib ?n ?a
26     
27     @to
28     Execute (print "\(?n) -> \(?a)")
29
30 main = transformation OneShotForward where
31 --
32 20 -> 10946
33 19 -> 6765
34 18 -> 4181
35 17 -> 2584
36 16 -> 1597
37 15 -> 987
38 14 -> 610
39 13 -> 377
40 12 -> 233
41 11 -> 144
42 10 -> 89
43 9 -> 55
44 8 -> 34
45 7 -> 21
46 6 -> 13
47 5 -> 8
48 4 -> 5
49 3 -> 3
50 2 -> 2
51 1 -> 1
52 0 -> 1
53 ()