@@ -194,6 +194,46 @@ function term_matcher_constructor(term, acSets)
194194 return nothing
195195 end
196196 return commutative_term_matcher
197+ # if the operation is sqrt, we have to match also ^(1//2)
198+ elseif operation (term)== sqrt
199+ function sqrt_matcher (success, data, bindings)
200+ ! islist (data) && return nothing # if data is not a list, return nothing
201+ data = car (data)
202+ ! iscall (data) && return nothing # if first element is not a call, return nothing
203+
204+ # do the normal matcher
205+ result = loop (data, bindings, matchers)
206+ result != = nothing && return success (result, 1 )
207+
208+ if (operation (data) === ^ ) && (arguments (data)[2 ] === 1 // 2 )
209+ T = symtype (arguments (data)[1 ])
210+ frankestein = Term {T} (sqrt,[arguments (data)[1 ]])
211+ result = loop (frankestein, bindings, matchers)
212+ result != = nothing && return success (result, 1 )
213+ end
214+ return nothing
215+ end
216+ return sqrt_matcher
217+ # if the operation is exp, we have to match also ℯ^
218+ elseif operation (term)== exp
219+ function exp_matcher (success, data, bindings)
220+ ! islist (data) && return nothing # if data is not a list, return nothing
221+ data = car (data)
222+ ! iscall (data) && return nothing # if first element is not a call, return nothing
223+
224+ # do the normal matcher
225+ result = loop (data, bindings, matchers)
226+ result != = nothing && return success (result, 1 )
227+
228+ if (operation (data) === ^ ) && (arguments (data)[1 ] === ℯ)
229+ T = symtype (arguments (data)[2 ])
230+ frankestein = Term {T} (exp,[arguments (data)[2 ]])
231+ result = loop (frankestein, bindings, matchers)
232+ result != = nothing && return success (result, 1 )
233+ end
234+ return nothing
235+ end
236+ return exp_matcher
197237 else
198238 function term_matcher (success, data, bindings)
199239 ! islist (data) && return nothing # if data is not a list, return nothing
0 commit comments