13 lines
316 B
Fennel
13 lines
316 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
|
|
([ancestor x y] [parent x y])
|
|
([ancestor x y] [parent x z] [ancestor z y]))
|
|
(pp (query s [p x y] [q (+ x 1)]))
|
|
|