@@ -127,28 +127,29 @@ function term_matcher_constructor(term, acSets)
127
127
end
128
128
129
129
# if the operation is a pow, we have to match also 1/(...)^(...) with negative exponent
130
- if operation (term)== ^
131
- function term_matcher_pow (success, data, bindings)
130
+ if operation (term) === ^
131
+ function pow_term_matcher (success, data, bindings)
132
132
! islist (data) && return nothing # if data is not a list, return nothing
133
- ! iscall (car (data)) && return nothing # if first element is not a call, return nothing
133
+ data = car (data) # from (..., ) to ...
134
+ ! iscall (data) && return nothing # if first element is not a call, return nothing
134
135
135
- result = loop (car ( data) , bindings, matchers)
136
+ result = loop (data, bindings, matchers)
136
137
result != = nothing && return success (result, 1 )
137
138
138
139
# if data is of the alternative form 1/(...)^(...), it might match with negative exponent
139
- if (operation (car ( data)) == / ) && arguments (car ( data)) [1 ]== 1 && iscall (arguments (car ( data)) [2 ]) && (operation (arguments (car ( data)) [2 ])== ^ )
140
- denominator = arguments (car ( data) )[2 ]
140
+ if (operation (data) === / ) && isequal ( arguments (data)[1 ], 1 ) && iscall (arguments (data)[2 ]) && (operation (arguments (data)[2 ]) === ^ )
141
+ denominator = arguments (data)[2 ]
141
142
T = symtype (denominator)
142
143
frankestein = Term {T} (^ , [arguments (denominator)[1 ], - arguments (denominator)[2 ]])
143
144
result = loop (frankestein, bindings, matchers)
144
145
result != = nothing && return success (result, 1 )
145
146
end
146
147
return nothing
147
148
end
148
- return term_matcher_pow
149
+ return pow_term_matcher
149
150
# if we want to do commutative checks, i.e. call matcher with different order of the arguments
150
151
elseif acSets!= = nothing && ! isa (arguments (term)[1 ], Segment) && operation (term) in [+ , * ]
151
- function term_matcher_comm (success, data, bindings)
152
+ function commutative_term_matcher (success, data, bindings)
152
153
! islist (data) && return nothing # if data is not a list, return nothing
153
154
! iscall (car (data)) && return nothing # if first element is not a call, return nothing
154
155
@@ -164,7 +165,7 @@ function term_matcher_constructor(term, acSets)
164
165
end
165
166
return nothing
166
167
end
167
- return term_matcher_comm
168
+ return commutative_term_matcher
168
169
else
169
170
function term_matcher (success, data, bindings)
170
171
! islist (data) && return nothing # if data is not a list, return nothing
0 commit comments