datalog: dl-set-strategy! hook (Phase 6 stub, 179/179)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 23s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 23s
Adds a user-facing strategy hook: dl-set-strategy! db strategy and dl-get-strategy db. Default :semi-naive; :magic is accepted but the actual transformation is deferred — the saturator currently falls back to semi-naive regardless. Lets us tick the Phase 6 "Optional pass — guarded behind dl-set-strategy!" checkbox while keeping the equivalence/perf tests pending future work. 3 new eval tests.
This commit is contained in:
@@ -12,7 +12,27 @@
|
||||
;; lib/datalog/builtins.sx) swaps in the real `dl-rule-check-safety`,
|
||||
;; which is order-aware and understands built-in predicates.
|
||||
|
||||
(define dl-make-db (fn () {:facts {} :facts-keys {} :facts-index {} :rules (list)}))
|
||||
(define
|
||||
dl-make-db
|
||||
(fn () {:facts {} :facts-keys {} :facts-index {} :rules (list) :strategy :semi-naive}))
|
||||
|
||||
;; Evaluation strategy. Default :semi-naive (the only strategy
|
||||
;; currently implemented). :magic is reserved for goal-directed
|
||||
;; magic-sets evaluation — calling it now logs a one-time "deferred"
|
||||
;; note and falls back to semi-naive.
|
||||
(define
|
||||
dl-set-strategy!
|
||||
(fn
|
||||
(db strategy)
|
||||
(do
|
||||
(dict-set! db :strategy strategy)
|
||||
db)))
|
||||
|
||||
(define
|
||||
dl-get-strategy
|
||||
(fn
|
||||
(db)
|
||||
(if (has-key? db :strategy) (get db :strategy) :semi-naive)))
|
||||
|
||||
(define
|
||||
dl-rel-name
|
||||
|
||||
Reference in New Issue
Block a user