@@ -6,8 +6,7 @@ module TermInterface
66Returns `true` if `x` is a term. If true, `operation`, `arguments`
77must also be defined for `x` appropriately.
88"""
9- istree (x) = istree (typeof (x))
10- istree (x:: Type{T} ) where {T} = false
9+ istree (x) = false
1110export istree
1211
1312"""
@@ -29,8 +28,7 @@ export symtype
2928Returns `true` if `x` is a symbol. If true, `nameof` must be defined
3029on `x` and must return a Symbol.
3130"""
32- issym (x) = issym (typeof (x))
33- issym (x:: Type{T} ) where {T} = false
31+ issym (x) = false
3432export issym
3533
3634"""
@@ -119,16 +117,9 @@ and `metadata` as the metadata. By default this will execute `head(args...)`.
119117when manipulating `Expr`s.
120118"""
121119function similarterm (x, head, args, symtype = nothing ; metadata = nothing , exprhead = nothing )
122- if exprhead === nothing
123- similarterm (typeof (x), head, args, symtype; metadata = metadata)
124- else
125- similarterm (typeof (x), head, args, symtype; metadata = metadata, exprhead = exprhead)
126- end
120+ ! istree (x) ? head : head (args... )
127121end
128122
129- function similarterm (x:: Type{T} , head, args, symtype = nothing ; metadata = nothing , exprhead = :call ) where {T}
130- ! istree (T) ? head : head (args... )
131- end
132123export similarterm
133124
134125include (" utils.jl" )
0 commit comments