-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue calling examples from the REPL #3
Comments
There shouldn't be an issue using facts between different namespaces. The So you might just try restarting the JVM to see if it works as expected. I'd like to offer a way around this pitfall but there isn't a great On Wed, Feb 18, 2015 at 9:30 AM, deaddowney notifications@github.com
|
Hi Ryan, I've created a git repo that reproduces the issue. https://github.com/deaddowney/clara-test I'm using maven to build my project and when I first compile from clean, I get a compilation error. When I compile again, it works and my rules fire. If I then run my main class, the rules do not fire. |
Hmm, this smells like an AOT compilation issue, since it seems to work I did notice the initial compilation failure is probably occurring because Any chance you can avoid using AOT? I've done Maven builds for projects I would like to get Clara to play nice with AOT, but was hoping to see some http://dev.clojure.org/display/design/AOT+Problem+Overview On Wed, Feb 18, 2015 at 3:02 PM, deaddowney notifications@github.com
|
Ryan, I would avoid running AOT, but I am not even able to run this interactively from my REPL (Cursive). It is my experience that records introduce all kinds of bugs compared to maps. I see that clara does support the use of maps through the :fact-type-fn. I’ll see if I can replace my records with maps and get things to work. Do you think Clojure-dev would be interested in looking at my test project as a test case for some of the AOT bugs?
|
Hey Adam, I was able to get that clara-test project running in Cursive by commenting out the compilation execution in the POM, running mvn clean, and making sure Cursive had src/main/clojure set up as a root source folder (for some reason it didn't when I imported the project). Once there, I ran the local REPL in Cursive and it worked well. I think Cursive was running into AOT problems here, picking up class files that Maven might have left in the target folder. I'm mostly an emacs user, but jump into Cursive on occasion (and am really starting to like it a lot!) Your idea of using :fact-type-fn against simple maps would probably work around these issues outright, so that's a good call if that works for you. I tend to use records reasons specific to the project in which I use Clara the most, but simple maps might work better for others. Anyway, here's the part of the POM I commented out: <!-- <execution>
<id>compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution> --> I also played with editing rules in the code and was able to reload them. Here's my REPL session, with the exclamation marks later on from an edit on the fly:
|
I'm going to dig a bit more into the AOT woes, maybe there is something we can do to make Clara work better in that setting. As a side note, if you have any questions or issues with Clara, the Google Group is probably a good forum: https://groups.google.com/forum/?hl=en#!forum/clara-rules |
I updated the version of Clojure to 1.7.0-alpha5 from alpha1, leaving the rest as is and now the exec:java task works. Thanks for pointing me to the AOT issues. It looks like they are actively dealing with them in 1.7, which is good news. |
I'm trying to test the examples in my REPL. I'm using the rules as defined in the examples but they don't seem to work as I get no output. I'm wondering if this is some sort of namespace issue.
Here is the code I'm running:
If I call (-main), I get the correct output. If I call (run-examples), it get:
VIP shopping example:
Summer special and widget promotion example:
Is there some issue with inserting facts from a different namespace?
The text was updated successfully, but these errors were encountered: