edtris/waltz/sqltest.fnl
Jeremy Penner 82d04e0649 comparison support, fix bugs in inference rules
* rule expression generation was miscounting the number of parameters
* allow using arbitrary expressions in the head of a rule
2022-03-27 14:34:50 -04:00

15 lines
474 B
Fennel

(local Sqlog (require :waltz.sqlog))
(import-macros {: $ : query : defrules} :waltz.macros)
(local s (Sqlog))
(s:deftable :parent :parent :child)
(s:deftable :p :x :y)
(s:deftable :q :z)
(defrules s
([generation name (|| name " jr") 2] [parent name (|| name " jr")])
([generation name (|| name " iii") 3] [ancestor name (|| name " iii")])
([ancestor x y] [parent x y])
([ancestor x y] [parent x z] [ancestor z y]))
(pp (query s [generation "bob" descendant nth]))