This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-01-13
Channels
- # admin-announcements (6)
- # beginners (51)
- # boot (164)
- # braid-chat (49)
- # cider (10)
- # clara (17)
- # cljs-dev (13)
- # cljsjs (51)
- # cljsrn (10)
- # clojars (42)
- # clojure (195)
- # clojure-bangladesh (102)
- # clojure-berlin (8)
- # clojure-canada (1)
- # clojure-chicago (19)
- # clojure-colombia (4)
- # clojure-denmark (6)
- # clojure-russia (15)
- # clojure-ukraine (7)
- # clojurescript (257)
- # code-reviews (10)
- # community-development (292)
- # core-async (13)
- # datomic (26)
- # dirac (4)
- # dunaj (5)
- # dysphemism (5)
- # events (21)
- # funcool (15)
- # hoplon (115)
- # instaparse (31)
- # ldnclj (15)
- # mori-fork (43)
- # mount (5)
- # off-topic (18)
- # om (195)
- # onyx (13)
- # proton (9)
- # re-frame (11)
- # reagent (44)
- # slack-help (14)
- # slackpocalypse (1)
- # spacemacs (10)
- # yada (23)
hello, I been fiddling around and im stuck at this right now: https://gist.github.com/datajohnny/3b82660ba27fd80f448c
Caused by: clojure.lang.ArityException: Wrong number of args (0) passed to: core/eval6101/->Person--6116
@ragge: what I want is to add that record when the rule is true
I thought I was accomplishing that in that manner
do I need to pass the params in?
another thing is that for some reason age the (>= 21 age)
is not working if I set the age on the session to 21
@datajohnny That test rule matches a person when the age is >= 21, so it is only true if such a person has already been inserted. The right-hand side of the rule is just a Clojure s-expression that can insert additional facts derived from what matched. So typically you would insert the person (as that example does), match on age >=21, and insert a new fact if that's the case (like a PersonIsAdult fact).
@datajohnny: If you want to get an idea of general usage patterns, I'd check out the examples at https://github.com/rbrush/clara-examples/tree/master/src/main/clojure/clara/examples
@ryanbrush: thanks
@datajohnny: You bet!
@ryanbrush: can the rules work with just maps instead of records, I am trying to build kinda like the same thing you had in your latest blog post but instead of grammar I am getting a json payload
@datajohnny: It can use records. You'll need to provide a function that returns a "type" for map you use, which will match the type of the rule. See the fact-type-fn at http://www.clara-rules.org/docs/expressions/#fact-expressions. There's also a unit test that shows some usage of it at https://github.com/rbrush/clara-rules/blob/master/src/test/clojure/clara/test_rules.clj#L1977. The test generates rules in place but you can see a provided fact-type-fn that just reads a field from a record in action.