Skip to content

Commit

Permalink
default issym -- also make it work on types for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
shashi committed Aug 30, 2021
1 parent def31aa commit f43dbdb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/TermInterface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ export symtype
Returns `true` if `x` is a symbol. If true, `nameof` must be defined
on `x` and must return a Symbol.
"""
function issym end
issym(x) = issym(typeof(x))
issym(x::Type{T}) where {T} = false
export issym

"""
Expand Down Expand Up @@ -96,7 +97,7 @@ similarterm(x, head, args, symtype=nothing; metadata=nothing) =
similarterm(x::Type{Expr}, head, args, symtype=nothing; metadata=nothing) = Expr(head, args...)

function similarterm(x::Type{T}, head, args, symtype=nothing; metadata=nothing) where T
if !istree(T) head else head(args...) end
!istree(T) ? head : head(args...)
end
export similarterm

Expand Down

0 comments on commit f43dbdb

Please sign in to comment.