Skip to content
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

Documentation on re-writing does not behave as expected #420

Closed
Andersen98 opened this issue Jan 15, 2022 · 4 comments
Closed

Documentation on re-writing does not behave as expected #420

Andersen98 opened this issue Jan 15, 2022 · 4 comments

Comments

@Andersen98
Copy link

I walked through the documentation here

r1(sin(2*(w-z))) does not match and r3 = @rule ~x * +(~~ys) => sum(map(y-> ~x * y, ~~ys)); r3(2 * (w+w+α+β)) does not match. I switched over to Metatheory.jl and it seems to work perfectly though.

@0x0f0f0f
Copy link
Member

The doc over here should probably be updated

@anstadnik
Copy link

Hi! Can it be resolved?
The only solution to figure out why @rule doesn't work as expected now is to read the code and commit messages.
I have a similar problem, and there is no place for me to start from.

@anstadnik
Copy link

This might be related

@karlwessel
Copy link
Contributor

This seems to have been fixed at some point, at least for me on 3.7 it gives the documented output:

julia> using SymbolicUtils
julia> @syms w z α::Real β::Real
(w, z, α, β)

julia> r1 = @rule sin(2(~x)) => 2sin(~x)*cos(~x)
sin(2 * ~x) => (2 * sin(~x)) * cos(~x)
julia> r1(sin(2*(w-z)))
2cos(w - z)*sin(w - z)

julia> r3 = @rule ~x * +(~~ys) => sum(map(y-> ~x * y, ~~ys));
julia> r3(2 * (w+w+α+β))
4w + 2α + 2β

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants