Fork me on GitHub

@saicheong: I haven't done what you're describing. You could try it but something tells me that won't work.


I am heading out otherwise I'd help you out.


@saicheong: I believe the problem with the constraint you have there is that you’re calling = with one argument, which always returns false. The symbol “this” in rule constraints is bound to the fact under consideration; I believe you need to test that “this” is equal to :exceed-cap. Example gist:


One thing to keep in mind (without knowing anything about your use-case of course) is that one of the major optimizations of Clara (and the Rete algorithm it is based on more generally) is only testing facts against conditions that their type allows them to match. That is, if you inserted something that isn’t a Keyword into the example in the gist above, that equality check wouldn’t ever be tried. Checking equality against a keyword should be very, very fast though, just something to be aware of more generally. Of course, if your use case is small enough even thinking about that could be premature optimization.


@devn: Thanks. I'll try it out when I get some time.


@wparker: thanks for the tip on using 'this' in the expression. I'll try that out too.