matchex cannot match subexpression
dyc-emet opened this issue · comments
Hi,
When I tried to use matchex like the following:
matchex(:(_A - _B), :(a * (x - y)))
It just give Nullable{Dict{Symbol, Any}}()
instead of _A => x, _B => y
Any suggestions?
matchex
tries to match expressions exactly, you are probably more interested in findex
:
julia> M = findex(:(_A - _B), :(a * (x - y)))
1-element Array{Any,1}:
:(x - y)
If you need to get exactly mapping _A => x, _B => y
, you can additionally use matchex
on each element of the returned array:
julia> matchex(:(_A - _B), M[1])
Nullable{Dict{Symbol,Any}}(Dict{Symbol,Any}(Pair{Symbol,Any}(:_A, :x),Pair{Symbol,Any}(:_B, :y)))
Thanks! That saves me! :)