Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 34s
mod/defrule collects trailing conditions via &rest; mod/ruleset assembles rules. No macro needed — conditions are plain data, fn supports &rest here. Produces structurally identical rules to mk-rule (asserted) and works in the engine unchanged. Closes the roadmap's original defrule surface. +11 tests. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
17 lines
661 B
Plaintext
17 lines
661 B
Plaintext
;; lib/mod/defrule.sx — ergonomic rule / ruleset construction.
|
|
;;
|
|
;; The roadmap sketched a (defrule action :when conditions) surface. Conditions
|
|
;; already evaluate to plain data, so this needs no macro — variadic functions
|
|
;; suffice: mod/defrule collects its trailing condition forms via &rest (dropping
|
|
;; the explicit outer (list ...)), and mod/ruleset assembles rules the same way.
|
|
;;
|
|
;; (mod/ruleset
|
|
;; (mod/defrule "spam-hide" :hide (list :classification "spam"))
|
|
;; (mod/defrule "default-keep" :keep))
|
|
|
|
(define
|
|
mod/defrule
|
|
(fn (name action &rest conds) (mod/mk-rule name action conds)))
|
|
|
|
(define mod/ruleset (fn (&rest rules) rules))
|