@@ -32,7 +32,7 @@ function matcher(slot::Slot, acSets)
32
32
val = get (bindings, slot. name, nothing )
33
33
# if slot name already is in bindings, check if it matches
34
34
if val != = nothing
35
- if isequal (val, car (data)):: Bool
35
+ if isequal (val, unwrap_const ( car (data) )):: Bool
36
36
return next (bindings, 1 )
37
37
end
38
38
# elseif the first element of data matches the slot predicate, add it to bindings and call next
@@ -74,7 +74,7 @@ function trymatchexpr(data, value, n)
74
74
end
75
75
76
76
return ! islist (value) ? n : nothing
77
- elseif isequal (value, data)
77
+ elseif isequal (unwrap_const ( value), unwrap_const ( data) )
78
78
return n + 1
79
79
end
80
80
end
@@ -137,17 +137,17 @@ function term_matcher_constructor(term, acSets)
137
137
result != = nothing && return success (result, 1 )
138
138
139
139
frankestein = nothing
140
- if (operation (data) === ^ ) && iscall (arguments (data)[1 ]) && (operation (arguments (data)[1 ]) === / ) && isequal (arguments (arguments (data)[1 ])[1 ], 1 )
140
+ if (operation (data) === ^ ) && iscall (arguments (data)[1 ]) && (operation (arguments (data)[1 ]) === / ) && _isone (arguments (arguments (data)[1 ])[1 ])
141
141
# if data is of the alternative form (1/...)^(...)
142
142
one_over_smth = arguments (data)[1 ]
143
143
T = vartype (one_over_smth)
144
144
frankestein = Term {T} (^ , [arguments (one_over_smth)[2 ], - arguments (data)[2 ]])
145
- elseif (operation (data) === / ) && isequal (arguments (data)[1 ], 1 ) && iscall (arguments (data)[2 ]) && (operation (arguments (data)[2 ]) === ^ )
145
+ elseif (operation (data) === / ) && _isone (arguments (data)[1 ]) && iscall (arguments (data)[2 ]) && (operation (arguments (data)[2 ]) === ^ )
146
146
# if data is of the alternative form 1/(...)^(...)
147
147
denominator = arguments (data)[2 ]
148
148
T = vartype (denominator)
149
149
frankestein = Term {T} (^ , [arguments (denominator)[1 ], - arguments (denominator)[2 ]])
150
- elseif (operation (data) === / ) && isequal (arguments (data)[1 ], 1 )
150
+ elseif (operation (data) === / ) && _isone (arguments (data)[1 ])
151
151
# if data is of the alternative form 1/(...), it might match with exponent = -1
152
152
denominator = arguments (data)[2 ]
153
153
T = vartype (denominator)
@@ -172,7 +172,7 @@ function term_matcher_constructor(term, acSets)
172
172
return pow_term_matcher
173
173
# if we want to do commutative checks, i.e. call matcher with different order of the arguments
174
174
elseif acSets!= = nothing && operation (term) in [+ , * ]
175
- has_segment = any ([isa (a ,Segment) for a in arguments (term)])
175
+ has_segment = any ([isa (unwrap_const (a) ,Segment) for a in arguments (term)])
176
176
function commutative_term_matcher (success, data, bindings)
177
177
! islist (data) && return nothing # if data is not a list, return nothing
178
178
data = car (data)
@@ -213,7 +213,7 @@ function term_matcher_constructor(term, acSets)
213
213
result = loop (data, bindings, matchers)
214
214
result != = nothing && return success (result, 1 )
215
215
216
- if (operation (data) === ^ ) && (arguments (data)[2 ] === 1 // 2 )
216
+ if (operation (data) === ^ ) && (unwrap_const ( arguments (data)[2 ]) === 1 // 2 )
217
217
T = vartype (arguments (data)[1 ])
218
218
frankestein = Term {T} (sqrt,[arguments (data)[1 ]])
219
219
result = loop (frankestein, bindings, matchers)
@@ -233,7 +233,7 @@ function term_matcher_constructor(term, acSets)
233
233
result = loop (data, bindings, matchers)
234
234
result != = nothing && return success (result, 1 )
235
235
236
- if (operation (data) === ^ ) && (arguments (data)[1 ] === ℯ)
236
+ if (operation (data) === ^ ) && (unwrap_const ( arguments (data)[1 ]) === ℯ)
237
237
T = vartype (arguments (data)[2 ])
238
238
frankestein = Term {T} (exp,[arguments (data)[2 ]])
239
239
result = loop (frankestein, bindings, matchers)
0 commit comments