Fork me on GitHub
#clara
<
2019-04-26
>
joel38004:04:19

is it possible to refer to the doc string on the RHS?

mikerod12:04:44

That seems odd. Maybe with a defrule style macro you could refer to its own self var and find the doc string on there somehow.

mikerod12:04:14

Would have to test that theory out though. Can’t at the moment.

ethanc13:04:34

Since clara allows arbitrary clojure in the rhs, most things are possible. It just seems a bit weird to do them:

(defrule a-rule
  "hello"
  [A (> x 3)]
  =>
  (println (:doc (meta #'a-rule))))

(-> (mk-session)
    (insert (->A 4))
    fire-rules)
hello

joel38023:04:01

well, i dunno like you say a bit weird, but at least possible.

joel38023:04:23

@ethanc --- commented on ticket #428 - curious if retract rules from :rule-matches reasonably possible.