]> gerrit.simantics Code Review - simantics/platform.git/blob - Transformation2.scl
45ad0658afc17f8bced0682d0e1fb25262b77e0f
[simantics/platform.git] / 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 ()