nemonik/Intellect

Allow rules to return a value

Closed this issue · 3 comments

It would be nice if rules could return an output value for use after reasoning. My own use case is for rules-based permissions. I would like to reason against a rule and an object, and return either True or False, depending on a user's ability to access the object.

In the then condition you could

a) learn an object
b) set a value on matching object and check the value on the object later as you hold a reference to all ear end objects
c) call a callable on your intellect
d) ...

Calling a callable should work. Thanks!

The read me has notes on how to decorate a method on your own subclass of Intellect, and I think the examples have an example of. At the very least Intellect's own log method is decorated as callable. So, use that as an example if you haven't already figured this out.

Also, I would very much like to hear what you are using Intellect for.