Fork me on GitHub
#clara
<
2022-02-27
>
apbleonard10:02:04

Hi - has anyone tried building auto generated documentation for Clara rulesets? I'm thinking of a Javadoc style HTML listing of all rules in the set and the facts they use and/or insert - and similarly for all facts - that you could browse around?

mikerod14:02:14

I think that this an interesting idea. I think that on the LHS of a rule it is achievable statically inspect the forms to generating information on the facts that are involved and matched on. The rules themself are compiled in a way that already must be able to inspect it in this regard. The RHS (action) of the rule though is fairly free form clj-code, so there is no guarantee that they can be inspected statically to know which sorts of facts are inserted. Of course if you constrain this either via a custom DSL, or just a convention, you can set up rules in a way that the types of facts that are RHS insert! (or similar) are inspectable.

apbleonard18:02:21

Yes that was along the lines I was considering. Our rules and facts are mostly very plain... if A & B insert! X .. but hopefully it would be possible to do in a fairly general form :thinking_face:

👍 1