;; To test on issue #143 (rule ((= x 1) (= y x)) ()) (rule ((= x 1) (= y x) (= z y)) ()) (function f (i64) i64) (set (f 0) 0) ;; a funky id rule (rule ((f x) (= x y) (= z y)) ((let a (f z)) (set (f (+ z 1)) (+ a 1)))) (run 20) (print-function f 100) (check (= (f 10) 10)) (datatype Value (Num i64)) (function fib (Value) Value) ;; a funky fibonacci that test on more complex case and user defined datatype (rule ((= (Num a) (fib (Num x))) (= (Num b) (fib (Num y))) (= x1 x) (= y1 y) (= a1 a) (= b1 b) (= x1 x2) (= y1 y2) (= a1 a2) (= b1 b2) (= 1 (- x2 y2))) ((let n (+ x 1)) (let sum (+ a1 b2)) (union (fib (Num n)) (Num sum)))) (union (fib (Num 1)) (Num 1)) (union (fib (Num 2)) (Num 1)) (run 20) (print-function fib 100) (check (= (fib (Num 10)) (Num 55)))