bomberpac/waltz/sqltest.fnl

14 lines
511 B
Plaintext
Raw Normal View History

2022-03-27 04:10:37 +00:00
(local Sqlog (require :waltz.sqlog))
2022-03-27 20:23:28 +00:00
(import-macros {: $ : query : insert : delete : update : defrules} :waltz.macros)
2022-03-27 04:10:37 +00:00
(local s (Sqlog))
(s:deftable :parent :parent :child)
2022-03-27 16:26:26 +00:00
(s:deftable :p :x :y)
(s:deftable :q :z)
2022-03-27 04:10:37 +00:00
(defrules s
([generation name (|| name " jr") 2] [parent name (|| name " jr")])
([generation name (|| name " iii") 3] [ancestor name (|| name " iii")])
2022-03-27 20:23:28 +00:00
([ancestor x y 1] [parent x y])
([ancestor x y (+ gen 1)] [parent x z] [ancestor z y gen]))
2022-03-27 20:49:22 +00:00
(pp (update s [p _ (+ y 1)] [p x y] [q x]))