JuliaSymbolics / SymbolicUtils.jl

Symbolic expressions, rewriting and simplification
https://docs.sciml.ai/SymbolicUtils/stable/
Other
545 stars 114 forks source link

Allow interpolating in LHS of the rules #275

Closed shashi closed 3 years ago

shashi commented 3 years ago

Came up while matching this:

using ModelingToolkit
@parameters x t
@variables u(..)
Dx = Differential(x)
rhs = Dx(u(t, x))
r = @rule Differential(x)(u(t,x)) => "yes"
@show r(rhs.val) # nothing

But now you can do

r = @rule $(Differential(x))(u(t,x)) => "yes"

and it will match

@emmanuellujan

codecov-io commented 3 years ago

Codecov Report

Merging #275 (29d2b7b) into master (9371e2a) will increase coverage by 0.02%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #275      +/-   ##
==========================================
+ Coverage   85.27%   85.29%   +0.02%     
==========================================
  Files          11       11              
  Lines        1161     1163       +2     
==========================================
+ Hits          990      992       +2     
  Misses        171      171              
Impacted Files Coverage Δ
src/matchers.jl 96.49% <100.00%> (ø)
src/rule.jl 86.48% <100.00%> (+0.24%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 9371e2a...29d2b7b. Read the comment docs.