-
Notifications
You must be signed in to change notification settings - Fork 116
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
Example from Interfacing Docs doesn't do x+x = 2*x #218
Comments
It's probably because of constructor-level simplification. Pattern like julia> @rule(~x + ~x => 2*(~x))(a + a) == nothing
true
julia> a + a
2a
julia> @rule(2*(~x) => "match!")(a + a)
"match!" I'm working on PR to include that information in manual and update examples. |
Thanks! Really appreciate the reply. Does this mean that when designing an interface, we need our constructors to do this automatic simplification as well? Because in the type piracy example from the docs, In the type piracy example rule I wrote at the beginning of this thread, If I just output it without rules, I get: ex = :x + :x
println(ex) #Outputs :((+)(x, x)) And the I've gotten some luck by simply doing something like Thank you for that PR, I feel like I've implemented exactly what is needed by the docs but the simplification is happening in only very few circumstances. There are definitely missing links I need to implement to get my expression tree to parse well, I hope that doc goes up soon so I can know exactly what to implement. |
The following seems like a very simple re-write but the pattern just isn't matched.
Here's a recreation using an example from the docs
I'm having some issues making this work and would really appreciate some help, and hope someone can point out what I'm doing wrong here.
If this really is a bug, I just want to help in pointing it out. Thanks!
The text was updated successfully, but these errors were encountered: