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